| Type: | Package |
| Title: | Clinical Indices and Outcomes Tools |
| Version: | 1.0.0 |
| Maintainer: | Neel Agarwal <neel.agarwal.216@gmail.com> |
| Description: | Collection of indices and tools relating to clinical research that aid epidemiological cohort or retrospective chart review with big data. All indices and tools take commonly used lab values, patient demographics, and clinical measurements to compute various risk and predictive values for survival or further classification/stratification. References to original literature and validation contained in each function documentation. Includes all commonly available calculators available online. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| NeedsCompilation: | no |
| Packaged: | 2025-11-30 22:13:04 UTC; neel |
| Author: | Neel Agarwal [aut, cre] |
| Repository: | CRAN |
| Date/Publication: | 2025-11-30 22:30:09 UTC |
Alveolar-arterial (A-a) Oxygen Gradient
Description
Calculates the A-a O2 Gradient, a measure of the difference between the alveolar concentration of oxygen (PAO2) and the arterial concentration of oxygen (PaO2). This gradient helps differentiate between extrapulmonary causes of hypoxemia (e.g., hypoventilation, high altitude) and intrapulmonary causes (e.g., V/Q mismatch, shunt, diffusion defects).
The function utilizes the Alveolar Gas Equation: PAO2 = (FiO2 * (Patm - PH2O)) - (PaCO2 / R) Where PH2O is assumed to be 47 mmHg and R (Respiratory Quotient) is assumed to be 0.8.
Usage
a_a_gradient(pao2, paco2, fio2, age = NULL, patm = 760, elevation_m = NULL)
Arguments
pao2 |
Numeric. Measured arterial partial pressure of oxygen (mmHg). |
paco2 |
Numeric. Measured arterial partial pressure of carbon dioxide (mmHg). |
fio2 |
Numeric. Fraction of Inspired Oxygen. Can be entered as a percentage (e.g., 21) or a decimal (e.g., 0.21). |
age |
Numeric (Optional). Patient age in years. Used to calculate the expected A-a gradient using the formula: (Age / 4) + 4. |
patm |
Numeric. Atmospheric pressure in mmHg. Defaults to 760 mmHg (Sea Level). |
elevation_m |
Numeric (Optional). Elevation in meters. If provided, this will override the 'patm' argument and estimate atmospheric pressure using the barometric formula. |
Value
A list containing:
A_a_Gradient_mmHg |
The calculated difference between alveolar and arterial oxygen. |
PAO2_Alveolar_Oxygen_mmHg |
The estimated partial pressure of oxygen in the alveoli. |
Expected_Gradient_mmHg |
The predicted normal gradient for the patient's age (if age is provided). |
Interpretation |
Clinical interpretation suggesting whether the gradient is normal (suggesting hypoventilation/low FiO2) or elevated (suggesting intrinsic lung pathology). |
References
Mellemgaard K. The alveolar-arterial oxygen difference: its size and components in normal man. Acta Physiol Scand. 1966;67(1):10-20. doi:10.1111/j.1748-1716.1966.tb03281.x
Kanber GJ, King FW, Eshchar YR, et al. The alveolar-arterial oxygen gradient in young and elderly men during air and oxygen breathing. Am Rev Respir Dis. 1968;97(3):376-381.
Examples
# Example 1: Normal Gradient (Hypoventilation)
# 30yo on Room Air (21%), PaO2 60, PaCO2 80
a_a_gradient(pao2 = 60, paco2 = 80, fio2 = 21, age = 30)
# Example 2: Elevated Gradient (V/Q Mismatch/Shunt)
# 60yo on 40% FiO2, PaO2 80, PaCO2 40
a_a_gradient(pao2 = 80, paco2 = 40, fio2 = 0.40, age = 60)
# Example 3: High Altitude
# 25yo at 3000m elevation
a_a_gradient(pao2 = 50, paco2 = 30, fio2 = 21, age = 25, elevation_m = 3000)
AAP Pediatric Hypertension Guidelines (2017)
Description
Classifies blood pressure in children and adolescents according to the 2017 American Academy of Pediatrics (AAP) Clinical Practice Guideline.
The function handles two age groups: 1. Adolescents (>= 13 years): Uses static absolute cutoffs matching adult guidelines (Normal, Elevated, Stage 1, Stage 2). 2. Children (1 to <13 years): Uses percentile-based logic. Note: Users must provide the child-specific 90th and 95th percentile BP thresholds (based on age, sex, and height) as arguments.
Usage
aap_pediatric_htn_guidelines(age, systolic, diastolic,
sbp_90th = NULL, sbp_95th = NULL,
dbp_90th = NULL, dbp_95th = NULL)
Arguments
age |
Numeric. Age of the patient in years. |
systolic |
Numeric. Measured systolic blood pressure (mmHg). |
diastolic |
Numeric. Measured diastolic blood pressure (mmHg). |
sbp_90th |
Numeric (Required for age < 13). The 90th percentile Systolic BP for the child's sex, age, and height. |
sbp_95th |
Numeric (Required for age < 13). The 95th percentile Systolic BP for the child's sex, age, and height. |
dbp_90th |
Numeric (Required for age < 13). The 90th percentile Diastolic BP for the child's sex, age, and height. |
dbp_95th |
Numeric (Required for age < 13). The 95th percentile Diastolic BP for the child's sex, age, and height. |
Value
A list containing:
Classification |
The BP category (Normal, Elevated, Stage 1, or Stage 2). |
Management_Recommendation |
Suggested follow-up actions based on the 2017 AAP CPG. |
Applied_Criteria |
Indicates whether adult (static) or pediatric (percentile) logic was used. |
References
Flynn JT, Kaelber DC, Baker-Smith CM, et al. Clinical Practice Guideline for Screening and Management of High Blood Pressure in Children and Adolescents. Pediatrics. 2017;140(3):e20171904. doi:10.1542/peds.2017-1904
Examples
# Example 1: Adolescent (14 years old) - Static Cutoffs
# BP 132/82 -> Stage 1 Hypertension
aap_pediatric_htn_guidelines(age = 14, systolic = 132, diastolic = 82)
# Example 2: Child (8 years old) - Percentile Based
# Measured: 112/60 -> Stage 1 (SBP > 95th)
aap_pediatric_htn_guidelines(
age = 8, systolic = 112, diastolic = 60,
sbp_90th = 105, sbp_95th = 109,
dbp_90th = 65, dbp_95th = 69
)
Abbey Pain Scale for Dementia Patients
Description
Calculates the Abbey Pain Scale score, a tool designed to assess pain in patients with advanced dementia who cannot verbalize their needs. The scale evaluates six domains: Vocalization, Facial Expression, Body Language, Behavioral Change, Physiological Change, and Physical Changes.
Usage
abbey_pain_scale(vocalization, facial_expression, body_language,
behavioral_change, physiological_change, physical_changes)
Arguments
vocalization |
Numeric (0-3). Whimpering, groaning, crying. (0=Absent, 1=Mild, 2=Moderate, 3=Severe). |
facial_expression |
Numeric (0-3). Looking tense, frowning, grimacing, frightened. (0=Absent, 1=Mild, 2=Moderate, 3=Severe). |
body_language |
Numeric (0-3). Fidgeting, rocking, guarding body part, withdrawn. (0=Absent, 1=Mild, 2=Moderate, 3=Severe). |
behavioral_change |
Numeric (0-3). Increased confusion, refusing to eat, alteration in usual patterns. (0=Absent, 1=Mild, 2=Moderate, 3=Severe). |
physiological_change |
Numeric (0-3). Temperature/pulse/BP changes, perspiration, flushing/pallor. (0=Absent, 1=Mild, 2=Moderate, 3=Severe). |
physical_changes |
Numeric (0-3). Skin tears, pressure areas, arthritis, contractures, previous injuries. (0=Absent, 1=Mild, 2=Moderate, 3=Severe). |
Value
A list containing:
Total_Score |
Sum of the 6 domain scores (Range 0-18). |
Pain_Category |
Interpretation of pain severity (No pain, Mild, Moderate, Severe). |
Management_Recommendation |
General guidance on intervention necessity. |
References
Abbey J, Piller N, De Bellis A, et al. The Abbey pain scale: a 1-minute numerical indicator for people with end-stage dementia. Int J Palliat Nurs. 2004;10(1):6-13. doi:10.12968/ijpn.2004.10.1.12013
Examples
# Example 1: Moderate Pain
# Mild vocalization (1), Moderate facial expression (2), Mild body language (1),
# No behavioral change (0), Mild physiological change (1), Severe physical change (3)
# Total = 8
abbey_pain_scale(1, 2, 1, 0, 1, 3)
# Example 2: No Pain
# All absent
abbey_pain_scale(0, 0, 0, 0, 0, 0)
Abbreviated Mental Test (AMT-10)
Description
Calculates the AMT-10 score, a screening tool for cognitive impairment in elderly patients. It consists of 10 questions, each scoring 1 point for a correct answer. A score of less than 8 suggests possible cognitive impairment.
Usage
abbreviated_mental_test_10(age_correct, time_correct, address_recall_correct,
year_correct, place_correct, recognition_correct,
dob_correct, ww1_date_correct, monarch_correct,
count_backwards_correct)
Arguments
age_correct |
Numeric (0 or 1). Correctly states own age. |
time_correct |
Numeric (0 or 1). Correctly states time (to nearest hour). |
address_recall_correct |
Numeric (0 or 1). Correctly recalls an address (e.g., "42 West Street") given by the examiner at the beginning of the test. |
year_correct |
Numeric (0 or 1). Correctly states the current year. |
place_correct |
Numeric (0 or 1). Correctly states the name of the place (e.g., hospital name or address). |
recognition_correct |
Numeric (0 or 1). Correctly identifies two persons (e.g., doctor, nurse). |
dob_correct |
Numeric (0 or 1). Correctly states date of birth. |
ww1_date_correct |
Numeric (0 or 1). Correctly states the year World War I began. |
monarch_correct |
Numeric (0 or 1). Correctly states the name of the current Monarch (or President/Head of State depending on region). |
count_backwards_correct |
Numeric (0 or 1). Correctly counts backwards from 20 to 1. |
Value
A list containing:
Total_Score |
Sum of the correct answers (Range 0-10). |
Interpretation |
Clinical suggestion based on the score (Normal >= 8, Abnormal < 8). |
References
Hodkinson HM. Evaluation of a mental test score for assessment of mental impairment in the elderly. Age Ageing. 1972;1(4):233-238. doi:10.1093/ageing/1.4.233
Examples
# Example 1: Normal Cognition
# All correct
abbreviated_mental_test_10(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
# Example 2: Possible Impairment
# Missed address recall, year, and counting backwards
abbreviated_mental_test_10(1, 1, 0, 0, 1, 1, 1, 1, 1, 0)
Abbreviated Mental Test 4 (AMT-4)
Description
Calculates the AMT-4 score, a rapid screening tool for cognitive impairment derived from the longer AMT-10. It assesses four specific domains: Age, Date of Birth, Place, and Year. A score of less than 4 indicates possible cognitive impairment.
Usage
abbreviated_mental_test_4(age_correct, dob_correct, place_correct, year_correct)
Arguments
age_correct |
Numeric (0 or 1). Correctly states own age. |
dob_correct |
Numeric (0 or 1). Correctly states date of birth. |
place_correct |
Numeric (0 or 1). Correctly states the name of the place (e.g., hospital name or address). |
year_correct |
Numeric (0 or 1). Correctly states the current year. |
Value
A list containing:
Total_Score |
Sum of the correct answers (Range 0-4). |
Interpretation |
Clinical suggestion based on the score (Normal = 4, Abnormal < 4). |
References
Swain DG, Nightingale PG. Evaluation of a shortened version of the Abbreviated Mental Test in a series of elderly patients. Clin Rehabil. 1997;11(3):243-248. doi:10.1177/026921559701100311
Examples
# Example 1: Normal Cognition
# All answers correct
abbreviated_mental_test_4(1, 1, 1, 1)
# Example 2: Possible Impairment
# Incorrect year
abbreviated_mental_test_4(1, 1, 1, 0)
ABC/2 Formula for Intracerebral Hemorrhage Volume
Description
Calculates the estimated volume of an intracerebral hemorrhage (ICH) using the ABC/2 formula. This simple geometric approximation correlates well with planimetric measurements and is widely used for prognosis and treatment stratification.
The formula assumes an ellipsoid shape: Volume = (A * B * C) / 2.
Usage
abc2_ich_volume(hemorrhage_length_cm, hemorrhage_width_cm, num_slices, slice_thickness_mm)
Arguments
hemorrhage_length_cm |
Numeric. The greatest diameter of the hemorrhage on the CT slice with the largest area (A). |
hemorrhage_width_cm |
Numeric. The diameter perpendicular to A on the same CT slice (B). |
num_slices |
Numeric. The number of CT slices containing the hemorrhage. Guidelines for counting slices: - Slice with >= 75% of the largest area: Counts as 1 slice. - Slice with 25-75% of the largest area: Counts as 0.5 slices. - Slice with < 25% of the largest area: Counts as 0 slices. |
slice_thickness_mm |
Numeric. The thickness of each CT slice in millimeters (typically provided in the scan metadata). |
Value
A list containing:
ICH_Volume_mL |
The calculated hemorrhage volume in cubic centimeters (mL). |
Interpretation |
Prognostic note based on the 30 mL cutoff used in the ICH Score. |
References
Kothari RU, Brott T, Broderick JP, et al. The ABCs of measuring intracerebral hemorrhage volumes. Stroke. 1996;27(8):1304-1305. doi:10.1161/01.str.27.8.1304
Examples
# Example 1: Large Hemorrhage
# 5cm x 4cm on largest slice, 12 slices total (all full size), 5mm thickness
# C = 12 * 0.5cm = 6cm. Volume = (5 * 4 * 6) / 2 = 60 mL
abc2_ich_volume(5, 4, 12, 5)
# Example 2: Small Hemorrhage
# 3cm x 2cm, 3 slices (5mm thick)
# C = 3 * 0.5cm = 1.5cm. Volume = (3 * 2 * 1.5) / 2 = 4.5 mL
abc2_ich_volume(3, 2, 3, 5)
Assessment of Blood Consumption (ABC) Score for Massive Transfusion
Description
Calculates the ABC Score to predict the need for massive transfusion in adult trauma patients. The score uses four non-laboratory variables available early in the trauma resuscitation to identify patients who may benefit from activation of a Massive Transfusion Protocol (MTP).
Usage
abc_massive_transfusion(penetrating_mechanism, positive_fast, sbp_mmHg, hr_bpm)
Arguments
penetrating_mechanism |
Numeric (0 or 1). Was the mechanism of injury penetrating? 1 = Yes, 0 = No. |
positive_fast |
Numeric (0 or 1). Was the Focused Assessment with Sonography for Trauma (FAST) positive? 1 = Yes, 0 = No. |
sbp_mmHg |
Numeric. Arrival Systolic Blood Pressure in mmHg. (1 point is added if SBP <= 90). |
hr_bpm |
Numeric. Arrival Heart Rate in beats per minute. (1 point is added if HR >= 120). |
Value
A list containing:
Total_Score |
The sum of risk factors present (Range 0-4). |
Interpretation |
Clinical interpretation indicating likelihood of needing massive transfusion (Score >= 2 suggests MTP activation). |
References
Nunez TC, Voskresensky IV, Dossett LA, et al. Early prediction of massive transfusion in trauma: simple as ABC (assessment of blood consumption)? J Trauma. 2009;66(2):346-352. doi:10.1097/TA.0b013e3181961c35
Examples
# Example 1: MTP Likely
# Penetrating trauma, Positive FAST, Hypotensive, Tachycardic
abc_massive_transfusion(1, 1, 85, 130)
# Example 2: MTP Unlikely
# Blunt trauma, Negative FAST, Stable vitals
abc_massive_transfusion(0, 0, 110, 88)
ABCD2 Score for TIA
Description
Calculates the ABCD2 Score to estimate the risk of stroke within 2, 7, and 90 days after a Transient Ischemic Attack (TIA). This score is widely used to determine the urgency of evaluation and the need for hospital admission.
Usage
abcd2_tia(age, bp_systolic, bp_diastolic, clinical_features, duration_min, diabetes)
Arguments
age |
Numeric. Patient age in years. (+1 point if >= 60). |
bp_systolic |
Numeric. Initial systolic blood pressure in mmHg. (+1 point if >= 140 or DBP >= 90). |
bp_diastolic |
Numeric. Initial diastolic blood pressure in mmHg. (+1 point if >= 90 or SBP >= 140). |
clinical_features |
Numeric (0, 1, or 2). Description of symptoms. 2: Unilateral weakness (+2 points). 1: Speech disturbance without weakness (+1 point). 0: Other symptoms (+0 points). |
duration_min |
Numeric. Duration of symptoms in minutes. >= 60 minutes (+2 points). 10-59 minutes (+1 point). < 10 minutes (0 points). |
diabetes |
Numeric (0 or 1). History of diabetes mellitus (oral medication or insulin). 1: Yes (+1 point). 0: No (0 points). |
Value
A list containing:
Score |
Total ABCD2 Score (Range 0-7). |
Risk_Category |
Risk classification (Low, Moderate, High). |
Stroke_Risk |
List of estimated stroke risks at 2, 7, and 90 days. |
Management |
Recommendation regarding hospital admission. |
References
Johnston SC, Rothwell PM, Nguyen-Huynh MN, et al. Validation and refinement of scores to predict very early stroke risk after transient ischaemic attack. Lancet. 2007;369(9558):283-92. doi:10.1016/S0140-6736(07)60150-0
Examples
# Example 1: High Risk
# 65yo, BP 150/90, Unilateral weakness, Duration 45 mins, Diabetes
# Age(1) + BP(1) + Weakness(2) + Duration(1) + Diabetes(1) = 6
abcd2_tia(65, 150, 90, 2, 45, 1)
# Example 2: Low Risk
# 45yo, BP 120/80, Speech disturbance only, Duration 5 mins, No Diabetes
# Age(0) + BP(0) + Speech(1) + Duration(0) + Diabetes(0) = 1
abcd2_tia(45, 120, 80, 1, 5, 0)
Arterial Blood Gas (ABG) Analyzer
Description
Interprets arterial blood gas values to identify acid-base disturbances. It determines the primary disorder (Respiratory vs. Metabolic, Acidosis vs. Alkalosis), assesses the degree of compensation (Acute vs. Chronic, or appropriate secondary response), and calculates the Anion Gap and Delta Ratio if electrolytes are provided.
Usage
abg_analyzer(ph, paco2, hco3, na = NULL, cl = NULL, albumin = 4.0)
Arguments
ph |
Numeric. Arterial pH. |
paco2 |
Numeric. Partial pressure of carbon dioxide (mmHg). |
hco3 |
Numeric. Bicarbonate concentration (mEq/L). |
na |
Numeric (Optional). Serum sodium (mEq/L). Required for Anion Gap calculation. |
cl |
Numeric (Optional). Serum chloride (mEq/L). Required for Anion Gap calculation. |
albumin |
Numeric (Optional). Serum albumin (g/dL). Used to correct the Anion Gap. Defaults to 4.0 if not provided. |
Value
A list containing:
Diagnosis |
The primary acid-base disorder identified. |
Compensation |
Analysis of the compensatory response (e.g., Uncompensated, Compensated, or Mixed). |
Anion_Gap_Analysis |
If electrolytes are provided, reports the Anion Gap (corrected for albumin) and the Delta Ratio interpretation for high gap acidosis. |
References
Adrogué HJ, Madias NE. Management of life-threatening acid-base disorders. N Engl J Med. 1998;338(1):26-34.
Examples
# Example 1: Diabetic Ketoacidosis (High AG Met Acidosis)
# pH 7.2, pCO2 25 (Compensated), HCO3 10, Na 140, Cl 100
abg_analyzer(7.2, 25, 10, 140, 100)
# Example 2: Acute Respiratory Acidosis (Opioid Overdose)
# pH 7.25, pCO2 60, HCO3 26 (Acute/Uncompensated)
abg_analyzer(7.25, 60, 26)
# Example 3: Mixed Disorder (Septic Shock + Vomiting)
# High AG Acidosis + Met Alkalosis
# pH 7.4, pCO2 40, HCO3 24 (Normal pH/Nos), but High Gap
# Na 140, Cl 90, Alb 4.0
# AG = 140 - (90 + 24) = 26. Delta Gap = 14. Delta HCO3 = 0. Ratio > 2.0
abg_analyzer(7.4, 40, 24, 140, 90)
ABIC Score for Alcoholic Hepatitis
Description
Calculates the ABIC (Age, Bilirubin, INR, Creatinine) Score to stratify the risk of death at 90 days in patients with alcoholic hepatitis. It categorizes patients into Low, Intermediate, and High risk groups, helping to guide treatment decisions such as the use of corticosteroids.
Usage
abic_alcoholic_hepatitis(age, bilirubin, inr, creatinine,
bilirubin_units = "mg/dL", creatinine_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. |
bilirubin |
Numeric. Serum bilirubin level. |
inr |
Numeric. International Normalized Ratio. |
creatinine |
Numeric. Serum creatinine level. |
bilirubin_units |
String. Units for bilirubin. Options: "mg/dL" (default) or "umol/L". |
creatinine_units |
String. Units for creatinine. Options: "mg/dL" (default) or "umol/L". |
Value
A list containing:
ABIC_Score |
The calculated score. |
Risk_Group |
Risk classification (Low, Intermediate, High). |
Est_90_Day_Survival |
Estimated survival rate at 90 days based on the validation cohort. |
References
Dominguez M, Rincon D, Abraldes JG, et al. A new scoring system for prognostic stratification of patients with alcoholic hepatitis. Am J Gastroenterol. 2008;103(11):2747-2756. doi:10.1111/j.1572-0241.2008.02104.x
Examples
# Example 1: High Risk
# 50yo, Bili 15 mg/dL, INR 2.0, Cr 1.5 mg/dL
# Score = (50*0.1) + (15*0.08) + (1.5*0.3) + (2.0*0.8) = 5 + 1.2 + 0.45 + 1.6 = 8.25 (Intermediate)
abic_alcoholic_hepatitis(50, 15, 2.0, 1.5)
# Example 2: Low Risk
# 40yo, Bili 3 mg/dL, INR 1.1, Cr 0.8 mg/dL
abic_alcoholic_hepatitis(40, 3, 1.1, 0.8)
Absolute Lymphocyte Count (ALC)
Description
Calculates the Absolute Lymphocyte Count (ALC) based on the total White Blood Cell (WBC) count and the percentage of lymphocytes from a differential blood count. ALC is a useful marker for immune function and is used in the monitoring of HIV/AIDS, post-transplant patients, and chemotherapy (e.g., assessing susceptibility to opportunistic infections).
Usage
absolute_lymphocyte_count(wbc, lymphs_percent)
Arguments
wbc |
Numeric. The total White Blood Cell count. Can be entered as cells/microL (e.g., 5000) or k/microL (e.g., 5.0). The output unit will match the input magnitude. |
lymphs_percent |
Numeric. The percentage of lymphocytes reported in the WBC differential (0-100). |
Value
A list containing:
ALC |
The calculated Absolute Lymphocyte Count in the same unit scale as the WBC input. |
Interpretation |
General classification (Lymphopenia < 1000 cells/microL, Lymphocytosis > 4000 cells/microL). The function attempts to detect if inputs were in k/microL for interpretation purposes. |
References
Al-Gwaiz LA, Babay HH. The diagnostic value of absolute lymphocyte count in typhoid fever. J Infect Dev Ctries. 2007;1(3):260-265.
Examples
# Example 1: Normal
# WBC 6000 cells/uL, 30% Lymphs
absolute_lymphocyte_count(6000, 30)
# Example 2: Lymphopenia (using k/uL input)
# WBC 3.5 k/uL, 15% Lymphs
# Result will be 0.525 k/uL (which is 525 cells/uL -> Lymphopenia)
absolute_lymphocyte_count(3.5, 15)
Absolute Neutrophil Count (ANC)
Description
Calculates the Absolute Neutrophil Count (ANC), a measure of the number of neutrophil granulocytes (including segmented neutrophils and bands) present in the blood. ANC is critical for assessing the risk of infection in patients undergoing chemotherapy or those with other immune system suppressions.
Usage
absolute_neutrophil_count(wbc, neutrophils_percent, bands_percent = 0)
Arguments
wbc |
Numeric. The total White Blood Cell count. Can be entered as cells/microL (e.g., 4500) or k/microL (e.g., 4.5). |
neutrophils_percent |
Numeric. The percentage of segmented neutrophils ("segs" or "polys") from the differential (0-100). |
bands_percent |
Numeric (Optional). The percentage of band neutrophils ("bands") from the differential (0-100). Defaults to 0 if not reported. |
Value
A list containing:
ANC |
The calculated Absolute Neutrophil Count. The unit scale matches the WBC input (e.g., if WBC is in k/uL, ANC is in k/uL). |
Interpretation |
Risk classification (Normal, Mild, Moderate, or Severe Neutropenia). The function attempts to auto-detect the unit scale for interpretation. |
References
Al-Gwaiz LA, Babay HH. The diagnostic value of absolute lymphocyte count in typhoid fever. J Infect Dev Ctries. 2007;1(3):260-265. (General hematology reference).
Examples
# Example 1: Severe Neutropenia (Chemotherapy patient)
# WBC 1.2 k/uL, 20% Segs, 5% Bands
# ANC = 1.2 * (0.20 + 0.05) = 0.3 k/uL (300 cells/uL)
absolute_neutrophil_count(1.2, 20, 5)
# Example 2: Normal
# WBC 6000 cells/uL, 50% Segs, 0% Bands
absolute_neutrophil_count(6000, 50)
Abuse Assessment Screen (AAS)
Description
Implements the Abuse Assessment Screen (AAS), a 5-item screening tool designed to detect domestic abuse (intimate partner violence) in pregnant and non-pregnant women in healthcare settings. It assesses emotional, physical, and sexual abuse, as well as fear of a partner.
Usage
abuse_assessment_screen(ever_abused, past_year_physically_hurt,
forced_sexual_activities, afraid_of_partner,
pregnant_and_hurt = 0)
Arguments
ever_abused |
Numeric (0 or 1). Question 1: "Have you ever been emotionally or physically abused by your partner or someone important to you?" (1 = Yes, 0 = No). |
past_year_physically_hurt |
Numeric (0 or 1). Question 2: "Within the last year, have you been hit, slapped, kicked, or otherwise physically hurt by someone?" (1 = Yes, 0 = No). |
forced_sexual_activities |
Numeric (0 or 1). Question 3: "Within the last year, has anyone forced you to have sexual activities?" (1 = Yes, 0 = No). |
afraid_of_partner |
Numeric (0 or 1). Question 4: "Are you afraid of your partner or anyone you listed above?" (1 = Yes, 0 = No). |
pregnant_and_hurt |
Numeric (0 or 1). Question 5 (If applicable): "Since you've been pregnant, have you been slapped, kicked, or otherwise physically hurt by someone?" (1 = Yes, 0 = No). Defaults to 0 if not pregnant or not applicable. |
Value
A list containing:
Screen_Result |
"Positive" or "Negative". |
Interpretation |
Clinical interpretation of the result. |
Recommendation |
Suggested clinical actions based on the screen. |
Questions_Affirmed |
A list indicating which specific questions were answered affirmatively. |
References
McFarlane J, Parker B, Soeken K, Bullock L. Assessing for abuse during pregnancy. Severity and frequency of injuries and associated entry into prenatal care. JAMA. 1992;267(23):3176-3178.
Examples
# Example 1: Positive Screen
# Patient reports being afraid of partner
abuse_assessment_screen(0, 0, 0, 1, 0)
# Example 2: Negative Screen
# No affirmative answers
abuse_assessment_screen(0, 0, 0, 0, 0)
ACC/AHA Heart Failure Staging
Description
Determines the stage of Heart Failure (A, B, C, or D) based on the American College of Cardiology (ACC) and American Heart Association (AHA) guidelines. This classification emphasizes the development and progression of the disease, from patients at risk to those with refractory symptoms.
Usage
acc_aha_hf_staging(risk_factors, structural_disease, hf_symptoms, refractory_hf)
Arguments
risk_factors |
Numeric (0 or 1). Patient has risk factors for HF (e.g., hypertension, diabetes, obesity, metabolic syndrome, family history of cardiomyopathy, or use of cardiotoxins) but no structural heart disease or symptoms. |
structural_disease |
Numeric (0 or 1). Patient has structural heart disease (e.g., prior MI, LV remodeling/LVH, low EF, valvular disease) but has never had signs or symptoms of HF. |
hf_symptoms |
Numeric (0 or 1). Patient has structural heart disease with prior or current symptoms of HF (e.g., dyspnea, fatigue, reduced exercise tolerance). |
refractory_hf |
Numeric (0 or 1). Patient has refractory HF requiring specialized interventions (e.g., marked symptoms at rest despite maximal medical therapy). |
Value
A list containing:
Stage |
The calculated ACC/AHA Stage (A, B, C, or D). |
Description |
Clinical description of the patient's status. |
Management_Guidance |
General therapeutic goals associated with the stage. |
References
Yancy CW, Jessup M, Bozkurt B, et al. 2013 ACCF/AHA Guideline for the Management of Heart Failure. Circulation. 2013;128(16):e240-e327. doi:10.1161/CIR.0b013e31829e8776
Examples
# Example 1: Stage C (Symptomatic)
# Patient with structural disease and dyspnea
acc_aha_hf_staging(1, 1, 1, 0)
# Example 2: Stage A (At Risk)
# Hypertension only, no structural disease or symptoms
acc_aha_hf_staging(1, 0, 0, 0)
Adverse Childhood Experiences (ACE) Score
Description
Calculates the Adverse Childhood Experiences (ACE) Score based on the 10-item survey from the CDC-Kaiser Permanente ACE Study. The score sums the number of categories of adverse experiences reported during the first 18 years of life. Higher scores are strongly correlated with negative health and behavioral outcomes later in life.
Usage
ace_score(emotional_abuse, physical_abuse, sexual_abuse, emotional_neglect,
physical_neglect, divorce_separation, domestic_violence,
substance_abuse, mental_illness, incarcerated_relative)
Arguments
emotional_abuse |
Numeric (0 or 1). Did a parent or adult in the household often swear at, insult, put down, or humiliate you? (1 = Yes). |
physical_abuse |
Numeric (0 or 1). Did a parent or adult in the household often push, grab, slap, or throw something at you? (1 = Yes). |
sexual_abuse |
Numeric (0 or 1). Did an adult or person at least 5 years older than you ever touch or fondle you or have you touch their body in a sexual way? (1 = Yes). |
emotional_neglect |
Numeric (0 or 1). Did you often feel that no one in your family loved you or thought you were important? (1 = Yes). |
physical_neglect |
Numeric (0 or 1). Did you often feel that you didn't have enough to eat, had to wear dirty clothes, or had no one to protect you? (1 = Yes). |
divorce_separation |
Numeric (0 or 1). Were your parents ever separated or divorced? (1 = Yes). |
domestic_violence |
Numeric (0 or 1). Was your mother or stepmother often pushed, grabbed, slapped, or had something thrown at her? (1 = Yes). |
substance_abuse |
Numeric (0 or 1). Did you live with anyone who was a problem drinker or alcoholic, or who used street drugs? (1 = Yes). |
mental_illness |
Numeric (0 or 1). Was a household member depressed or mentally ill, or did a household member attempt suicide? (1 = Yes). |
incarcerated_relative |
Numeric (0 or 1). Did a household member go to prison? (1 = Yes). |
Value
A list containing:
Total_Score |
The sum of affirmative answers (Range 0-10). |
Interpretation |
General risk assessment associated with the score count. |
References
Felitti VJ, Anda RF, Nordenberg D, et al. Relationship of childhood abuse and household dysfunction to many of the leading causes of death in adults. The Adverse Childhood Experiences (ACE) Study. Am J Prev Med. 1998;14(4):245-258. doi:10.1016/s0749-3797(98)00017-8
Examples
# Example 1: High Risk
# Divorce, Substance Abuse, Mental Illness, Incarceration
ace_score(0, 0, 0, 0, 0, 1, 0, 1, 1, 1)
# Example 2: Low Risk
# No adverse experiences reported
ace_score(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
ACEF II Risk Score for Cardiac Surgery
Description
Calculates the ACEF II (Age, Creatinine, Ejection Fraction II) Risk Score to predict 30-day operative mortality in patients undergoing elective or emergency cardiac surgery. This updated version of the original ACEF score incorporates emergency status and preoperative anemia (hematocrit).
Usage
acef_ii_cardiac_surgery(age, ejection_fraction, creatinine_mg_dl,
hematocrit, emergency_surgery)
Arguments
age |
Numeric. Patient age in years. |
ejection_fraction |
Numeric. Left ventricular ejection fraction in percentage (e.g., 50 for 50%). |
creatinine_mg_dl |
Numeric. Serum creatinine level in mg/dL. (Score adds 2.0 points if > 2.0 mg/dL). |
hematocrit |
Numeric. Preoperative hematocrit in percentage (e.g., 38 for 38%). (Score adds 0.2 points for each percentage point below 36%). |
emergency_surgery |
Numeric (0 or 1). 1 if surgery is emergency (required before the beginning of the next working day), 0 otherwise. (Score adds 3.0 points if Yes). |
Value
A list containing:
ACEF_II_Score |
The calculated risk score. |
Interpretation |
General prognostic guidance. |
References
Ranucci M, Castelvecchio S, Menicanti L, et al. The ACEF II Risk Score for cardiac surgery: updated but still parsimonious. Eur Heart J. 2018;39(23):2183-2189. doi:10.1093/eurheartj/ehx039
Examples
# Example 1: Low Risk
# 65yo, EF 55%, Cr 1.0, Hct 40%, Elective
# Score = 65/55 = 1.18
acef_ii_cardiac_surgery(65, 55, 1.0, 40, 0)
# Example 2: High Risk
# 75yo, EF 30%, Cr 2.5, Hct 30%, Emergency
# Score = (75/30) + 2.0 + 3.0 + (0.2 * (36-30))
# = 2.5 + 2.0 + 3.0 + 1.2 = 8.7
acef_ii_cardiac_surgery(75, 30, 2.5, 30, 1)
ACEP ED COVID-19 Management Tool (Severity Classification)
Description
Classifies the severity of COVID-19 infection in adult patients presenting to the Emergency Department based on the American College of Emergency Physicians (ACEP) COVID-19 Management Tool guidelines. The classification (Mild, Moderate, Severe, Critical) is used to guide diagnostic testing, disposition, and treatment decisions.
Usage
acep_covid19_management(spo2, resp_rate, signs_of_shock_mods = FALSE,
resp_failure = FALSE, lower_resp_disease = FALSE,
infiltrates_gt_50 = FALSE, pao2_fio2 = NULL,
symptoms_present = TRUE)
Arguments
spo2 |
Numeric. Oxygen saturation (%) on room air. |
resp_rate |
Numeric. Respiratory rate in breaths per minute. |
signs_of_shock_mods |
Logical. Presence of septic shock or multiple organ dysfunction syndrome (MODS). |
resp_failure |
Logical. Presence of respiratory failure requiring advanced support. |
lower_resp_disease |
Logical. Evidence of lower respiratory disease during clinical assessment or imaging (e.g., pneumonia). |
infiltrates_gt_50 |
Logical. Lung infiltrates > 50% on chest imaging. |
pao2_fio2 |
Numeric (Optional). Ratio of arterial partial pressure of oxygen to fraction of inspired oxygen (PaO2/FiO2). |
symptoms_present |
Logical. Presence of any COVID-19 symptoms (fever, cough, etc.). Defaults to TRUE. |
Value
A list containing:
Severity_Classification |
The assigned severity category (Mild, Moderate, Severe, Critical). |
Clinical_Definition |
Description of the criteria met for the classification. |
Suggested_Management |
General disposition and treatment recommendations based on ACEP guidelines. |
References
American College of Emergency Physicians (ACEP). ACEP COVID-19 Field Guide: Emergency Department COVID-19 Management Tool. 2023 Update.
Examples
# Example 1: Severe Illness
# SpO2 92%, RR 22, Positive Infiltrates (but not >50%)
# Severity driven by Hypoxia (SpO2 < 94%)
acep_covid19_management(spo2 = 92, resp_rate = 22, lower_resp_disease = TRUE)
# Example 2: Mild Illness
# SpO2 98%, RR 16, Symptoms present, No lower respiratory disease
acep_covid19_management(spo2 = 98, resp_rate = 16, lower_resp_disease = FALSE)
# Example 3: Critical Illness
# Shock present
acep_covid19_management(spo2 = 88, resp_rate = 35, signs_of_shock_mods = TRUE)
Acetaminophen Overdose NAC Dosing (Rumack-Matthew Nomogram)
Description
Determines the need for N-acetylcysteine (NAC) treatment following a single acute acetaminophen ingestion. The function utilizes the Rumack-Matthew Nomogram logic, specifically the "Treatment Line" (starting at 150 mcg/mL at 4 hours), to interpret serum acetaminophen levels obtained between 4 and 24 hours post-ingestion.
Usage
acetaminophen_nomogram(time_ingestion_hrs, acetaminophen_level, units = "mcg/mL")
Arguments
time_ingestion_hrs |
Numeric. Time passed since the ingestion in hours. The nomogram is valid only for single acute ingestions between 4 and 24 hours. |
acetaminophen_level |
Numeric. The measured serum acetaminophen concentration. |
units |
String. Units of the concentration measurement. Options: "mcg/mL" (default) "mg/L" "mg/dL" "micromol/L" |
Value
A list containing:
Standardized_Level_mcg_mL |
The input level converted to mcg/mL. |
Treatment_Threshold_mcg_mL |
The nomogram threshold value for the specific time provided. |
Recommendation |
Clinical guidance based on whether the level falls above or below the treatment line. |
References
Rumack BH, Matthew H. Acetaminophen poisoning and toxicity. Pediatrics. 1975;55(6):871-876.
Examples
# Example 1: Treatment Needed
# 8 hours post-ingestion, Level 100 mcg/mL
# Threshold at 8 hours is 75 mcg/mL -> Above line
acetaminophen_nomogram(8, 100, "mcg/mL")
# Example 2: No Treatment
# 5 hours post-ingestion, Level 100 mcg/mL
# Threshold at 5 hours is ~126 mcg/mL -> Below line
acetaminophen_nomogram(5, 100, "mcg/mL")
# Example 3: Different Units
# 4 hours post, Level 20 mg/dL -> Converts to 200 mcg/mL (Above 150 threshold)
acetaminophen_nomogram(4, 20, "mg/dL")
2015 ACR/EULAR Gout Classification Criteria
Description
Calculates the score for the 2015 ACR/EULAR Gout Classification Criteria. These criteria apply to patients with at least one episode of peripheral joint/bursa swelling, pain, or tenderness (Entry Criterion). The presence of MSU crystals is sufficient for diagnosis. If MSU crystals are not confirmed, a scoring system based on clinical, laboratory, and imaging features is used.
Usage
acr_eular_gout_2015(entry_criteria, sufficient_criteria, joint_pattern,
symptom_characteristics, episode_time_course, clinical_tophus,
serum_urate, synovial_fluid_negative, imaging_urate,
imaging_erosion)
Arguments
entry_criteria |
Numeric (0 or 1). Has the patient had at least one episode of swelling, pain, or tenderness in a peripheral joint or bursa? (1 = Yes, 0 = No). |
sufficient_criteria |
Numeric (0 or 1). Presence of MSU crystals in a symptomatic joint, bursa, or tophus. (1 = Yes, 0 = No). |
joint_pattern |
Numeric. Pattern of joint involvement. 0: Other pattern. 1: Ankle or midfoot (mono- or oligoarticular involvement without 1st MTP). 2: 1st MTP (mono- or oligoarticular involvement). |
symptom_characteristics |
Numeric (0-3). Count of characteristics present during an episode: 1) Erythema overlying joint, 2) Can't bear touch/pressure, 3) Great difficulty walking or inability to use joint. |
episode_time_course |
Numeric. Presence of typical episodes (Time to maximal pain <24h, Resolution <=14 days, Complete resolution between episodes). 0: None. 1: One typical episode. 2: Recurrent typical episodes. |
clinical_tophus |
Numeric (0 or 1). Presence of draining or chalk-like subcutaneous nodule under transparent skin. (1 = Yes, 0 = No). |
serum_urate |
Numeric. Serum urate level in mg/dL. Scores: <4 mg/dL (-4), 4-<6 (0), 6-<8 (+2), 8-<10 (+3), >=10 (+4). |
synovial_fluid_negative |
Numeric (0 or 1). Synovial fluid study was performed and was negative for MSU. (1 = Yes/Negative, 0 = Not done). |
imaging_urate |
Numeric (0 or 1). Evidence of urate deposition via DECT or Ultrasound (Double Contour Sign). (1 = Yes, 0 = No). |
imaging_erosion |
Numeric (0 or 1). Evidence of gout-related erosion on X-ray of hands/feet. (1 = Yes, 0 = No). |
Value
A list containing:
Classification |
"Classified as Gout", "Not Classified as Gout", or "Not Classified" (if entry not met). |
Total_Score |
The calculated score (if sufficient criteria not met). |
Interpretation |
Clinical interpretation of the score. |
References
Neogi T, Jansen TL, Dalbeth N, et al. 2015 Gout classification criteria: an American College of Rheumatology/European League Against Rheumatism collaborative initiative. Ann Rheum Dis. 2015;74(10):1789-1798. doi:10.1136/annrheumdis-2015-208237
Examples
# Example 1: Classic Gout Presentation
# 1st MTP (2), 3 Characteristics (3), Recurrent episodes (2), Urate 9.0 (3)
# Score = 2 + 3 + 2 + 3 = 10 -> Classified as Gout
acr_eular_gout_2015(1, 0, 2, 3, 2, 0, 9.0, 0, 0, 0)
# Example 2: Negative Workup
# Ankle (1), 1 Characteristic (1), One episode (1), Urate 5.0 (0)
# Score = 1 + 1 + 1 + 0 = 3 -> Not Classified
acr_eular_gout_2015(1, 0, 1, 1, 1, 0, 5.0, 0, 0, 0)
ACR/EULAR 2010 Rheumatoid Arthritis Classification Criteria
Description
Calculates the score for the 2010 American College of Rheumatology (ACR) / European League Against Rheumatism (EULAR) Classification Criteria for Rheumatoid Arthritis (RA). A score of 6 or greater (out of 10) classifies a patient as having definite RA.
This criteria set is intended for use in patients who have at least 1 joint with definite clinical synovitis (swelling) and with the synovitis not better explained by another disease.
Usage
acr_eular_ra_2010(joint_involvement, serology, acute_phase_reactants, duration_symptoms)
Arguments
joint_involvement |
Numeric. Score for joint involvement. 0: 1 large joint (0 points). 1: 2-10 large joints (1 point). 2: 1-3 small joints (with or without large joints) (2 points). 3: 4-10 small joints (with or without large joints) (3 points). 4: >10 joints (at least 1 small joint) (5 points). |
serology |
Numeric. Score for Rheumatoid Factor (RF) and Anti-Citrullinated Protein Antibody (ACPA). 0: Negative RF AND negative ACPA (0 points). 1: Low-positive RF OR low-positive ACPA (2 points). 2: High-positive RF OR high-positive ACPA (3 points). (Negative: <= ULN; Low-positive: > ULN but <= 3x ULN; High-positive: > 3x ULN). |
acute_phase_reactants |
Numeric. Score for Acute-Phase Reactants (CRP and ESR). 0: Normal CRP AND normal ESR (0 points). 1: Abnormal CRP OR abnormal ESR (1 point). |
duration_symptoms |
Numeric. Duration of synovitis symptoms. 0: < 6 weeks (0 points). 1: >= 6 weeks (1 point). |
Value
A list containing:
Total_Score |
The calculated classification score (Range 0-10). |
Classification |
"Definite Rheumatoid Arthritis" if score >= 6, otherwise "Not Classified as Rheumatoid Arthritis". |
References
Aletaha D, Neogi T, Silman AJ, et al. 2010 Rheumatoid arthritis classification criteria: an American College of Rheumatology/European League Against Rheumatism collaborative initiative. Arthritis Rheum. 2010;62(9):2569-2581. doi:10.1002/art.27584
Examples
# Example 1: Definite RA
# 4-10 small joints (3 pts), High-positive RF (3 pts), Normal CRP (0 pts), <6 weeks (0 pts)
# Total = 6
acr_eular_ra_2010(3, 2, 0, 0)
# Example 2: Not Classified
# 1-3 small joints (2 pts), Negative Serology (0 pts), Abnormal CRP (1 pt), >=6 weeks (1 pt)
# Total = 4
acr_eular_ra_2010(2, 0, 1, 1)
ACTION ICU Score for NSTEMI
Description
Calculates the ACTION ICU Score to predict the risk of in-hospital complications (cardiac arrest, shock, high-grade AV block, respiratory failure, stroke, or death) in patients with Non-ST-Elevation Myocardial Infarction (NSTEMI). This tool helps triage patients who may benefit from Intensive Care Unit (ICU) admission versus those who can be safely managed in a non-ICU setting (e.g., step-down or telemetry unit).
Usage
action_icu_nstemi(age, creatinine, heart_rate, sbp, troponin_x_uln,
heart_failure, st_depression, prior_revasc, chronic_lung_disease)
Arguments
age |
Numeric. Patient age in years. (>= 70 years adds +1 point). |
creatinine |
Numeric. Serum creatinine in mg/dL. (>= 1.1 mg/dL adds +1 point). |
heart_rate |
Numeric. Heart rate in beats per minute (bpm). (< 85: 0 points; 85-100: +1 point; >= 100: +3 points). |
sbp |
Numeric. Systolic blood pressure in mmHg. (< 125: +3 points; 125-145: +1 point; > 145: 0 points). |
troponin_x_uln |
Numeric. Initial troponin level expressed as a multiple of the Upper Limit of Normal (e.g., if Troponin is 0.5 and ULN is 0.1, input 5). (>= 12x ULN adds +2 points). |
heart_failure |
Numeric (0 or 1). Signs or symptoms of heart failure on admission. (Yes adds +5 points). |
st_depression |
Numeric (0 or 1). ST-segment depression on ECG. (Yes adds +1 point). |
prior_revasc |
Numeric (0 or 1). History of prior coronary revascularization (PCI or CABG). Note: **Absence** of prior revascularization adds risk in this model. (No = +1 point; Yes = 0 points). |
chronic_lung_disease |
Numeric (0 or 1). History of chronic lung disease (e.g., COPD). (Yes adds +2 points). |
Value
A list containing:
Total_Score |
The calculated ACTION ICU Score (Range 0-17). |
Risk_Prediction |
Estimated risk of complications requiring ICU care. |
Recommendation |
Guidance on ICU vs. non-ICU admission based on the score threshold of 5. |
References
Fanari Z, et al. Risk Score to Predict Need for Intensive Care in Initially Hemodynamically Stable Adults With Non-ST-Segment-Elevation Myocardial Infarction. J Am Heart Assoc. 2018;7(11):e008894. doi:10.1161/JAHA.118.008894
Examples
# Example 1: High Risk Candidate for ICU
# 72yo (+1), Cr 1.5 (+1), HR 110 (+3), SBP 110 (+3), HF present (+5), No prior revasc (+1)
# Score = 14 -> High Risk
action_icu_nstemi(72, 1.5, 110, 110, 5, 1, 0, 0, 0)
# Example 2: Low Risk (Floor Candidate)
# 60yo (0), Cr 0.9 (0), HR 70 (0), SBP 150 (0), Trop 2x (0), No HF (0), Prior Revasc (0)
# Score = 0
action_icu_nstemi(60, 0.9, 70, 150, 2, 0, 0, 1, 0)
Acute Gout Diagnosis Rule (Janssens Rule)
Description
Calculates the Acute Gout Diagnosis Rule score to estimate the probability of gout in primary care patients presenting with acute arthritis. This rule is particularly useful when synovial fluid analysis is not immediately available. It categorizes patients into Low, Intermediate, or High probability groups based on clinical and laboratory features.
Usage
acute_gout_diagnosis(sex, prev_attack, onset_1day, joint_redness,
mtp1_involvement, htn_cvd, uric_acid_elevated)
Arguments
sex |
String. Patient sex ("Male" or "Female"). (Male sex adds +2 points). |
prev_attack |
Numeric (0 or 1). Patient-reported previous arthritis attack. (1 = Yes, +2 points). |
onset_1day |
Numeric (0 or 1). Onset of symptoms within 1 day (maximal pain <24 hours). (1 = Yes, +0.5 points). |
joint_redness |
Numeric (0 or 1). Observed joint redness. (1 = Yes, +1 point). |
mtp1_involvement |
Numeric (0 or 1). Involvement of the 1st metatarsophalangeal (MTP1) joint. (1 = Yes, +2.5 points). |
htn_cvd |
Numeric (0 or 1). Presence of Hypertension or >= 1 Cardiovascular Disease (Angina, MI, Heart Failure, CVA, TIA, or PVD). (1 = Yes, +1.5 points). |
uric_acid_elevated |
Numeric (0 or 1). Serum Uric Acid > 5.88 mg/dL (> 0.35 mmol/L). (1 = Yes, +3.5 points). |
Value
A list containing:
Total_Score |
The calculated score (Range 0-13). |
Probability |
Estimated probability of gout (<2.2%, ~31%, or >80%). |
Recommendation |
Diagnostic guidance (Rule out, Test Fluid, or Treat). |
References
Janssens HJ, Fransen J, van de Lisdonk EH, et al. A diagnostic rule for acute gouty arthritis in primary care without joint fluid analysis. Arch Intern Med. 2010;170(13):1120-1126. doi:10.1001/archinternmed.2010.196
Examples
# Example 1: High Probability
# Male, Previous Attack, Rapid Onset, MTP1, HTN, High Uric Acid
# Score = 2 + 2 + 0.5 + 2.5 + 1.5 + 3.5 = 12
acute_gout_diagnosis("male", 1, 1, 0, 1, 1, 1)
# Example 2: Low Probability
# Female, Rapid Onset, Redness, No other features
# Score = 0.5 + 1 = 1.5
acute_gout_diagnosis("female", 0, 1, 1, 0, 0, 0)
Acute Pancreatitis Prediction Model
Description
Calculates a prediction score for the likelihood of acute pancreatitis in patients presenting with elevated lipase. A score of 6 or greater suggests a high probability of acute pancreatitis, helping to differentiate it from other causes of hyperlipasemia.
Usage
acute_pancreatitis_prediction_model(prior_episodes, cholelithiasis, recent_surgery,
epigastric_pain, worsening_severity,
pain_duration_days, pain_severity_score,
lipase_uln_multiplier)
Arguments
prior_episodes |
Numeric. Number of prior acute pancreatitis episodes. (0-1 = 0 pts; 2 = +2 pts; 3 = +3 pts; >=4 = +4 pts). |
cholelithiasis |
Numeric (0 or 1). History of cholelithiasis (gallstones). (1 = Yes, +2 pts). |
recent_surgery |
Numeric (0 or 1). Abdominal surgery within the prior 2 months. (1 = Yes, -2 pts). |
epigastric_pain |
Numeric (0 or 1). Presence of epigastric pain. (1 = Yes, +2 pts). |
worsening_severity |
Numeric (0 or 1). Is the pain worsening in severity? (1 = Yes, +1 pt). |
pain_duration_days |
Numeric. Duration of pain in days. (1-5 days = +1 pt; otherwise 0). |
pain_severity_score |
Numeric. Pain severity on a scale of 0-10. (0-3 = 0 pts; 4-6 = +2 pts; 7-10 = +3 pts). |
lipase_uln_multiplier |
Numeric. Serum lipase level expressed as a multiple of the Upper Limit of Normal (ULN). (3 to <10 = 0 pts; 10 to <20 = +1 pt; >=20 = +2 pts). |
Value
A list containing:
Total_Score |
The calculated prediction score. |
Risk_Assessment |
"Low Risk" or "High Probability" based on the cutoff of 6. |
References
Jang DK, et al. Development and Validation of a Prediction Model for Acute Pancreatitis in Patients with Elevated Serum Lipase. Sci Rep. 2019.
Examples
# Example 1: High Probability
# No prior eps, Stones present (+2), No surgery, Epigastric pain (+2),
# Worsening (+1), 2 days duration (+1), Severe pain (+3), Lipase 25x (+2)
# Score = 2 + 2 + 1 + 1 + 3 + 2 = 11
acute_pancreatitis_prediction_model(0, 1, 0, 1, 1, 2, 8, 25)
# Example 2: Low Risk
# 1 prior ep (0), No stones, Recent surgery (-2), No epigastric pain,
# Not worsening, 10 days duration (0), Mild pain (0), Lipase 5x (0)
# Score = -2
acute_pancreatitis_prediction_model(1, 0, 1, 0, 0, 10, 2, 5)
American Diabetes Association (ADA) Risk Calculator
Description
Calculates the risk score for Type 2 Diabetes using the American Diabetes Association (ADA) Risk Test. This tool evaluates risk factors including age, sex, family history, hypertension, physical activity, and BMI to determine if a patient is at high risk and should be screened for diabetes.
Usage
ada_diabetes_risk(age, sex, family_history, high_bp, physically_active,
height_in, weight_lbs, history_gestational_dm = 0)
Arguments
age |
Numeric. Patient age in years. < 40: 0 points. 40-49: 1 point. 50-59: 2 points. >= 60: 3 points. |
sex |
String. Patient sex ("Male" or "Female"). Male: +1 point. Female: 0 points. |
family_history |
Numeric (0 or 1). Do you have a mother, father, sister, or brother with diabetes? (1 = Yes, +1 point). |
high_bp |
Numeric (0 or 1). Have you ever been diagnosed with high blood pressure? (1 = Yes, +1 point). |
physically_active |
Numeric (0 or 1). Are you physically active? (1 = Yes, 0 points; 0 = No, +1 point). |
height_in |
Numeric. Patient height in inches. |
weight_lbs |
Numeric. Patient weight in pounds. (Used to calculate BMI). BMI < 25: 0 points. BMI 25-29.9: +1 point. BMI 30-39.9: +2 points. BMI >= 40: +3 points. |
history_gestational_dm |
Numeric (0 or 1). For women: Have you ever been diagnosed with gestational diabetes? (1 = Yes, +1 point). Defaults to 0. |
Value
A list containing:
Total_Score |
The calculated ADA risk score (Range 0-11). |
Risk_Category |
"High Risk" (Score >= 5) or "Low Risk" (Score < 5). |
Recommendation |
Guidance on whether to seek clinical testing. |
Calculated_BMI |
The BMI derived from the height and weight inputs. |
References
Bang H, Edwards AM, Bomback AS, et al. Development and validation of a patient self-assessment score for diabetes risk. Ann Intern Med. 2009;151(11):775-783. doi:10.7326/0003-4819-151-11-200912010-00005
Examples
# Example 1: High Risk
# 55yo Male, Family Hx, High BP, Inactive, Overweight (BMI ~27)
# Age(2) + Sex(1) + Fam(1) + BP(1) + Inactive(1) + BMI(1) = 7
ada_diabetes_risk(55, "male", 1, 1, 0, 70, 190, 0)
# Example 2: Low Risk
# 35yo Female, Active, Normal Weight, No other factors
# Age(0) + Sex(0) + Fam(0) + BP(0) + Active(0) + BMI(0) = 0
ada_diabetes_risk(35, "female", 0, 0, 1, 65, 130, 0)
ADAPT Protocol for Cardiac Event Risk
Description
Implements the 2-Hour Accelerated Diagnostic Protocol to Assess Patients with Chest Pain Symptoms (ADAPT). This protocol identifies low-risk patients who can be safely discharged from the Emergency Department within 2 hours.
To be classified as "Low Risk" (safe for discharge), a patient must meet ALL of the following criteria: 1. TIMI Score = 0. 2. No new ischemic changes on ECG. 3. Negative Troponin at 0 hours. 4. Negative Troponin at 2 hours.
Usage
adapt_cardiac_risk(timi_score, ekg_new_ischemia,
troponin_0h_positive, troponin_2h_positive)
Arguments
timi_score |
Numeric. The patient's TIMI Risk Score for UA/NSTEMI (Range 0-7). |
ekg_new_ischemia |
Numeric (0 or 1). Presence of new ischemic changes on ECG. (1 = Yes, 0 = No). |
troponin_0h_positive |
Numeric (0 or 1). Baseline (0-hour) troponin result above the institutional cutoff. (1 = Positive, 0 = Negative). |
troponin_2h_positive |
Numeric (0 or 1). 2-hour troponin result above the institutional cutoff. (1 = Positive, 0 = Negative). |
Value
A list containing:
Risk_Category |
"Low Risk" or "Not Low Risk". |
MACE_Risk_30_Day |
Estimated risk of Major Adverse Cardiac Events at 30 days. |
Recommendation |
Clinical guidance regarding discharge vs. observation. |
References
Than M, Cullen L, Aldous S, et al. 2-Hour Accelerated Diagnostic Protocol to Assess Patients With Chest Pain Symptoms Using Contemporary Troponins as the Only Biomarker: The ADAPT Trial. J Am Coll Cardiol. 2012;59(23):2091-2098. doi:10.1016/j.jacc.2012.02.035
Examples
# Example 1: Low Risk (Safe for discharge)
# TIMI 0, No EKG changes, Negative Troponins x2
adapt_cardiac_risk(0, 0, 0, 0)
# Example 2: Not Low Risk
# TIMI 1, No EKG changes, Negative Troponins x2
adapt_cardiac_risk(1, 0, 0, 0)
# Example 3: Not Low Risk
# TIMI 0, No EKG changes, Positive 2h Troponin
adapt_cardiac_risk(0, 0, 0, 1)
ADHERE Algorithm for Acute Decompensated Heart Failure
Description
Implements the classification regression tree (CART) analysis from the Acute Decompensated Heart Failure National Registry (ADHERE). This algorithm uses admission Blood Urea Nitrogen (BUN), Systolic Blood Pressure (SBP), and Serum Creatinine to stratify patients into four risk groups for in-hospital mortality.
Usage
adhere_algorithm(bun, sbp, creatinine)
Arguments
bun |
Numeric. Blood Urea Nitrogen in mg/dL. (The first splitting node is at 43 mg/dL). |
sbp |
Numeric. Systolic Blood Pressure in mmHg. (The second splitting node is at 115 mmHg). |
creatinine |
Numeric. Serum Creatinine in mg/dL. (The third splitting node is at 2.75 mg/dL). |
Value
A list containing:
Risk_Group |
The risk classification (Low, Intermediate, High, or Very High). |
In_Hospital_Mortality_Risk |
The estimated in-hospital mortality percentage associated with the specific node in the validation set. |
References
Fonarow GC, Adams KF Jr, Abraham WT, et al. Risk stratification for in-hospital mortality in acutely decompensated heart failure: classification and regression tree analysis. JAMA. 2005;293(5):572-580. doi:10.1001/jama.293.5.572
Examples
# Example 1: Low Risk (BUN < 43)
adhere_algorithm(bun = 30, sbp = 120, creatinine = 1.0)
# Example 2: Very High Risk (BUN >= 43, SBP < 115, Cr >= 2.75)
adhere_algorithm(bun = 50, sbp = 100, creatinine = 3.0)
Adult Self-Report Scale (ASRS-v1.1) for ADHD
Description
Calculates the score for Part A of the World Health Organization (WHO) Adult Self-Report Scale (ASRS-v1.1) Screener for ADHD. This 6-item tool screens for Attention-Deficit/Hyperactivity Disorder in adults.
Usage
adult_adhd_self_report_scale(q1_trouble_wrapping_up,
q2_difficulty_getting_organized,
q3_problems_remembering_appointments,
q4_procrastinate_difficult_tasks,
q5_fidgety, q6_overly_active)
Arguments
q1_trouble_wrapping_up |
Numeric (0-4). How often do you have trouble wrapping up the final details of a project, once the challenging parts have been done? |
q2_difficulty_getting_organized |
Numeric (0-4). How often do you have difficulty getting things in order when you have to do a task that requires organization? |
q3_problems_remembering_appointments |
Numeric (0-4). How often do you have problems remembering appointments or obligations? |
q4_procrastinate_difficult_tasks |
Numeric (0-4). When you have a task that requires a lot of thought, how often do you avoid or delay getting started? |
q5_fidgety |
Numeric (0-4). How often do you fidget or squirm with your hands or feet when you have to sit down for a long time? |
q6_overly_active |
Numeric (0-4). How often do you feel overly active and compelled to do things, like you were driven by a motor? |
Details
Scoring Key: 0 = Never 1 = Rarely 2 = Sometimes 3 = Often 4 = Very Often
Thresholds: Questions 1-3 are considered positive if the response is "Sometimes", "Often", or "Very Often" (Score >= 2). Questions 4-6 are considered positive if the response is "Often" or "Very Often" (Score >= 3).
Value
A list containing:
Part_A_Score |
The count of positive items (Range 0-6). |
Screening_Result |
"Screening Positive" if 4 or more items are positive, otherwise "Screening Negative". |
References
Kessler RC, Adler L, Ames M, et al. The World Health Organization Adult ADHD Self-Report Scale (ASRS): a short screening scale for use in the general population. Psychol Med. 2005;35(2):245-56.
Examples
# Example 1: Positive Screen
# Q1-Q3: Often (3), Q4-Q6: Often (3) -> All positive
adult_adhd_self_report_scale(3, 3, 3, 3, 3, 3)
# Example 2: Negative Screen
# All responses "Rarely" (1)
adult_adhd_self_report_scale(1, 1, 1, 1, 1, 1)
Age-Adjusted D-dimer for VTE
Description
Applies an age-adjusted cutoff to D-dimer interpretation for the exclusion of Venous Thromboembolism (VTE), including Pulmonary Embolism (PE) and Deep Vein Thrombosis (DVT). In patients > 50 years old, the cutoff is adjusted to (Age * 10) ng/mL, increasing specificity without compromising sensitivity.
Usage
age_adjusted_d_dimer(age, d_dimer, d_dimer_units = "ng/mL")
Arguments
age |
Numeric. Patient age in years. |
d_dimer |
Numeric. The measured D-dimer level. |
d_dimer_units |
String. Units of the D-dimer measurement. "ng/mL" (default) - uses a base cutoff of 500. "ug/mL" or "mg/L" - input is converted to ng/mL (multiplied by 1000) before comparison. |
Value
A list containing:
Age_Adjusted_Cutoff_ng_mL |
The calculated threshold for this patient. |
Patient_D_dimer_ng_mL |
The patient's D-dimer standardized to ng/mL. |
Result |
"Negative" (Rule out) or "Positive" (Further testing needed). |
Interpretation |
Clinical guidance based on the result. |
References
Righini M, Van Es J, Den Exter PL, et al. Age-adjusted D-dimer cutoff levels to rule out pulmonary embolism: the ADJUST-PE study. JAMA. 2014;311(11):1117-1124. doi:10.1001/jama.2014.2135
Examples
# Example 1: 65-year-old with D-dimer 600 ng/mL
# Standard cutoff (500) would be positive.
# Age-adjusted cutoff (65 * 10 = 650) is higher.
# Result: Negative (600 < 650) -> PE Ruled Out.
age_adjusted_d_dimer(65, 600)
# Example 2: 40-year-old with D-dimer 600 ng/mL
# Age <= 50, so cutoff remains 500.
# Result: Positive (600 > 500).
age_adjusted_d_dimer(40, 600)
# Example 3: 70-year-old with D-dimer 0.8 ug/mL
# Converts to 800 ng/mL. Cutoff is 700.
# Result: Positive (800 > 700).
age_adjusted_d_dimer(70, 0.8, "ug/mL")
Age-Adjusted ESR and CRP
Description
Calculates the upper limit of normal for Erythrocyte Sedimentation Rate (ESR) and C-Reactive Protein (CRP) based on patient age and sex. Standard reference ranges often misclassify elderly patients as having elevated inflammatory markers due to the natural physiological rise of these markers with age. These formulas provide a more accurate cutoff for inflammation.
Usage
age_adjusted_esr_crp(age, sex, esr = NULL, crp = NULL)
Arguments
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). |
esr |
Numeric (Optional). Patient's measured ESR (mm/hr). If provided, the function determines if it is elevated. |
crp |
Numeric (Optional). Patient's measured CRP (mg/dL). If provided, the function determines if it is elevated. |
Value
A list containing:
Calculated_ESR_Upper_Limit |
The age-adjusted upper limit for ESR (Formula: Male=Age/2; Female=(Age+10)/2). |
Calculated_CRP_Upper_Limit |
The age-adjusted upper limit for CRP (Formula: Male=Age/50; Female=Age/50 + 0.6). |
Patient_Values |
The input values provided. |
Interpretation |
Status ("Normal" or "Elevated") for the provided values against the calculated limits. |
References
Miller A, Green M, Robinson D. Simple rule for calculating normal erythrocyte sedimentation rate. Br Med J (Clin Res Ed). 1983;286(6361):266.
Wener MH, Daum PR, McQuillan GM. The influence of age, sex, and race on the upper reference limit of serum C-reactive protein concentration. J Rheumatol. 2000;27(10):2351-2359.
Examples
# Example 1: 70-year-old Female
# ESR Limit = (70 + 10) / 2 = 40
# CRP Limit = (70 / 50) + 0.6 = 1.4 + 0.6 = 2.0
age_adjusted_esr_crp(70, "female")
# Example 2: Evaluation of specific labs
# 60-year-old Male with ESR 25 and CRP 1.5
# ESR Limit = 30 (Normal); CRP Limit = 1.2 (Elevated)
age_adjusted_esr_crp(60, "male", esr = 25, crp = 1.5)
Calculate Stroke Risk for General Population based off AHA Patient Stroke risk calculator
Description
Using common patient history of comorbidities and conditions, in addition to traditional lifestyle factors, assess the total risk of suffering a stroke. Developed by the AHA and revised in 2023 for patient use, a positive score is associated with a high likelihood of suffering a stroke while a negative score has a low likelihood. Has not been validated for clinical use.
Usage
aha_stroke(bp, afib, sugar, bmi, diet, chol, dm, physical, hx, smoke)
Arguments
bp |
Blood pressure greater than 120/80? 1 for yes or unsure / 0 for no. |
afib |
Diagnosed atrial fibrillation? 1 for yes or unsure / 0 for no. |
sugar |
Blood sugar greater than 100 mg/dL? 1 for yes or unsure / 0 for no. |
bmi |
BMI >25 kg/m^2? 1 for yes or unsure / 0 for no. |
diet |
Diet high in saturated/trans fats, sweetened bevs, salt, excess calories? 1 for yes or unsure / 0 for no. |
chol |
Total blood cholesterol >160 mg/dL? 1 for yes or unsure / 0 for no. |
dm |
Diagnosis of T2 diabetes mellitus? 1 for yes or unsure / 0 for no. |
physical |
Less than 150 minutes of moderate to vigorous intensite activity per week? 1 for yes or unsure / 0 for no. |
hx |
Personal or family hx of stroke, TIA, or heart attack? 1 for yes or unsure / 0 for no. |
smoke |
Use tobacco or vape? 1 for yes or unsure / 0 for no. |
Value
A numeric value/vector with predicted stroke risk score.
References
“Stroke Risk Assessment.” www.stroke.org, December 14, 2023. https://www.stroke.org/en/about-stroke/stroke-risk-factors/stroke-risk-assessment.
Examples
# The function is defined as
aha_stroke(1, 0, 1, 1, 0, 0, 0, 0, 1, 0)
AIMS65 Score for Upper GI Bleeding Mortality
Description
Calculates the AIMS65 score to predict in-hospital mortality in patients with acute upper gastrointestinal bleeding (UGIB). The acronym stands for Albumin, INR, Mental status, Systolic blood pressure, and age 65.
Usage
aims65_upper_gi_bleed(albumin_g_dl, inr, altered_mental_status, sbp_mmhg, age_years)
Arguments
albumin_g_dl |
Numeric. Serum albumin level in g/dL. (< 3.0 g/dL adds +1 point). |
inr |
Numeric. International Normalized Ratio. (> 1.5 adds +1 point). |
altered_mental_status |
Numeric (0 or 1). Presence of altered mental status (GCS < 14 or disorientation). (1 = Yes, +1 point). |
sbp_mmhg |
Numeric. Systolic blood pressure in mmHg. (<= 90 mmHg adds +1 point). |
age_years |
Numeric. Patient age in years. (>= 65 years adds +1 point). |
Value
A list containing:
Total_Score |
The calculated AIMS65 score (Range 0-5). |
In_Hospital_Mortality_Risk |
Estimated mortality percentage based on the validation study. |
Risk_Stratification |
General classification (High Risk if Score >= 2). |
References
Saltzman JR, Tabak YP, Hyett BH, Sun X, Travis AC, Johannes RS. A simple risk score accurately predicts in-hospital mortality, length of stay, and cost in acute upper GI bleeding. Gastrointest Endosc. 2011;74(6):1215-1224. doi:10.1016/j.gie.2011.06.024
Examples
# Example 1: High Risk
# Albumin 2.5 (+1), INR 2.0 (+1), Alert (0), SBP 85 (+1), Age 70 (+1)
# Score = 4
aims65_upper_gi_bleed(2.5, 2.0, 0, 85, 70)
# Example 2: Low Risk
# Albumin 4.0 (0), INR 1.0 (0), Alert (0), SBP 120 (0), Age 40 (0)
# Score = 0
aims65_upper_gi_bleed(4.0, 1.0, 0, 120, 40)
Abnormal Involuntary Movement Scale (AIMS)
Description
Calculates the total score for the first 7 items of the AIMS to screen for Tardive Dyskinesia (TD) in patients receiving neuroleptic therapy. It also provides a diagnostic interpretation based on the Schooler-Kane criteria.
Usage
aims_tardive_dyskinesia(facial, lips, jaw, tongue, upper_ext, lower_ext, trunk)
Arguments
facial |
Numeric (0-4). Muscles of Facial Expression (e.g., frowning, grimacing). |
lips |
Numeric (0-4). Lips and Perioral Area (e.g., puckering, smacking). |
jaw |
Numeric (0-4). Jaw (e.g., biting, clenching, chewing). |
tongue |
Numeric (0-4). Tongue (e.g., protrusion, tremor). |
upper_ext |
Numeric (0-4). Upper Extremities (e.g., choreic movements). |
lower_ext |
Numeric (0-4). Lower Extremities (e.g., tapping, stomping). |
trunk |
Numeric (0-4). Neck, Shoulders, and Hips (e.g., rocking, twisting). |
Details
Scoring Key: 0 = None 1 = Minimal (may be extreme normal) 2 = Mild 3 = Moderate 4 = Severe
Value
A list containing:
Total_Score |
Sum of items 1-7. |
Interpretation |
Diagnostic suggestion (Positive if >=3 in 1 area OR >=2 in 2 areas). |
References
Guy W. ECDEU Assessment Manual for Psychopharmacology. Rockville, MD: US Department of Health, Education, and Welfare Public Health Service Alcohol, Drug Abuse, and Mental Health Administration. 1976.
Examples
# Example 1: Positive for TD
# Moderate Tongue (3) movement, others minimal
aims_tardive_dyskinesia(1, 1, 1, 3, 1, 0, 0)
# Example 2: Negative for TD
# Mild Facial (2) movement only
aims_tardive_dyskinesia(2, 0, 0, 0, 0, 0, 0)
Acute Interstitial Nephritis (AIN) Risk Calculator
Description
Calculates the probability of biopsy-proven Acute Interstitial Nephritis (AIN) in patients with acute kidney injury. This model uses variables from the electronic health record (Serum Creatinine, BUN, Urine Specific Gravity, and Urine Protein) to differentiate AIN from other causes of AKI (e.g., Acute Tubular Necrosis). The formula is derived from Moledina et al. and includes an adjustment for local disease prevalence.
Usage
ain_risk_calculator(creatinine, bun, urine_specific_gravity,
urine_protein_high, local_ain_prevalence = 0.23)
Arguments
creatinine |
Numeric. Serum creatinine in mg/dL. |
bun |
Numeric. Blood Urea Nitrogen in mg/dL. |
urine_specific_gravity |
Numeric. Specific gravity from urine dipstick or analysis (e.g., 1.015). |
urine_protein_high |
Numeric (0 or 1). Urine dipstick protein result. 0: Trace/1+ or lower (Low Protein). 1: 2+ or higher (High Protein). Note: High protein reduces the probability of AIN in this model. |
local_ain_prevalence |
Numeric. The estimated prevalence of AIN in the biopsy population at the local institution. Defaults to 0.23 (23%). |
Value
A list containing:
Probability_AIN_Percent |
The calculated probability of AIN as a percentage. |
Interpretation |
Risk categorization (Low <20%, Intermediate 20-50%, High >=50%). |
References
Moledina DG, Wilson FP, Puthumana J, et al. Development and External Validation of a Diagnostic Model for Biopsy-Proven Acute Interstitial Nephritis Using Electronic Health Record Data. J Clin Invest. 2019;133(13):e168950.
Examples
# Example 1: High Risk AIN
# High Cr, Low BUN/Cr ratio, Low SG, Low Protein
ain_risk_calculator(4.0, 40, 1.010, 0)
# Example 2: Low Risk AIN (Likely ATN/Glomerular)
# Lower Cr, High Ratio, High SG, High Protein
ain_risk_calculator(1.5, 30, 1.020, 1)
Appendicitis Inflammatory Response (AIR) Score
Description
Calculates the AIR Score to predict the likelihood of acute appendicitis. Designed to outperform the Alvarado score, the AIR score incorporates objective inflammatory markers (CRP and PMN proportion) alongside clinical signs to stratify patients into low, intermediate, or high probability groups.
Usage
air_appendicitis(vomiting, rlq_pain, rebound_tenderness, temp_c,
wbc_count, pmn_percent, crp_mg_l)
Arguments
vomiting |
Numeric (0 or 1). Presence of vomiting. (1 = Yes, +1 point). |
rlq_pain |
Numeric (0 or 1). Pain in the right inferior fossa. (1 = Yes, +1 point). |
rebound_tenderness |
Numeric (0-3). Grade of rebound tenderness or muscular defense. 0: None. 1: Light (+1 point). 2: Medium (+2 points). 3: Strong (+3 points). |
temp_c |
Numeric. Body temperature in Celsius. (>= 38.5 C adds +1 point). |
wbc_count |
Numeric. White Blood Cell count (x10^9/L). 10.0 - 14.9: +1 point. >= 15.0: +2 points. |
pmn_percent |
Numeric. Proportion of polymorphonuclear leukocytes (%). 70 - 84%: +1 point. >= 85%: +2 points. |
crp_mg_l |
Numeric. C-Reactive Protein level (mg/L). 10 - 49: +1 point. >= 50: +2 points. |
Value
A list containing:
AIR_Score |
The calculated score (Range 0-12). |
Risk_Group |
Probability grouping (Low 0-4, Indeterminate 5-8, High 9-12). |
Recommendation |
Clinical management suggestion based on the Andersson et al. validation. |
References
Andersson M, Andersson RE. The appendicitis inflammatory response score: a tool for the diagnosis of acute appendicitis that outperforms the Alvarado score. World J Surg. 2008;32(8):1843-1849. doi:10.1007/s00268-008-9649-y
Examples
# Example 1: High Probability
# Vomiting, RLQ pain, Strong Rebound (3), Temp 39 (1), WBC 16 (2), PMN 90% (2), CRP 60 (2)
# Score = 1 + 1 + 3 + 1 + 2 + 2 + 2 = 12
air_appendicitis(1, 1, 3, 39, 16, 90, 60)
# Example 2: Low Probability
# RLQ pain only, Normal labs
# Score = 1
air_appendicitis(0, 1, 0, 37, 8, 60, 5)
Asthma Impairment and Risk Questionnaire (AIRQ)
Description
Calculates the AIRQ score, a 10-item, yes/no questionnaire designed to assess asthma control in patients aged 12 years and older. It evaluates both current impairment (past 2 weeks) and future risk (past 12 months). The total score stratifies patients into Well-controlled, Not well-controlled, or Very poorly controlled categories.
Usage
airq_asthma_score(symptoms_gt_4days, awakening_gt_1time, activity_limited_daily,
rescue_inhaler_daily, social_limited, exercise_limited,
difficult_control, oral_steroids_12mo, er_visit_12mo,
hospital_overnight_12mo)
Arguments
symptoms_gt_4days |
Numeric (0 or 1). In the past 2 weeks, did symptoms bother you during the day on more than 4 days? (1 = Yes). |
awakening_gt_1time |
Numeric (0 or 1). In the past 2 weeks, did symptoms wake you up from sleep more than 1 time? (1 = Yes). |
activity_limited_daily |
Numeric (0 or 1). In the past 2 weeks, did symptoms limit the activities you wanted to do every day? (1 = Yes). |
rescue_inhaler_daily |
Numeric (0 or 1). In the past 2 weeks, did symptoms cause you to use your rescue inhaler or nebulizer every day? (1 = Yes). |
social_limited |
Numeric (0 or 1). In the past 2 weeks, did you have to limit your social activities because of your asthma? (1 = Yes). |
exercise_limited |
Numeric (0 or 1). In the past 2 weeks, did symptoms limit your ability to exercise? (1 = Yes). |
difficult_control |
Numeric (0 or 1). In the past 2 weeks, did you feel that it was difficult to control your asthma? (1 = Yes). |
oral_steroids_12mo |
Numeric (0 or 1). In the past 12 months, did symptoms cause you to take steroid pills or shots (e.g., prednisone)? (1 = Yes). |
er_visit_12mo |
Numeric (0 or 1). In the past 12 months, did symptoms cause you to go to the ER or have unplanned visits? (1 = Yes). |
hospital_overnight_12mo |
Numeric (0 or 1). In the past 12 months, did symptoms cause you to stay in the hospital overnight? (1 = Yes). |
Value
A list containing:
AIRQ_Score |
The total number of affirmative answers (Range 0-10). |
Control_Level |
Interpretation: "Well-controlled" (0-1), "Not well-controlled" (2-4), or "Very poorly controlled" (5-10). |
Exacerbation_Risk |
Projected risk of exacerbation in the next year based on the control level. |
References
Murphy KR, et al. Development of the Asthma Impairment and Risk Questionnaire (AIRQ): A Composite Control Measure. J Allergy Clin Immunol Pract. 2020;8(7):2263-2274.e5. doi:10.1016/j.jaip.2020.02.042
Examples
# Example 1: Very Poorly Controlled
# Symptoms >4 days, Waking >1, Exercise limited, Felt difficult to control, Steroids used
# Score = 5
airq_asthma_score(1, 1, 0, 0, 0, 1, 1, 1, 0, 0)
# Example 2: Well-Controlled
# No symptoms or history of exacerbations
# Score = 0
airq_asthma_score(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Abbreviated Injury Score (AIS) for Inhalation Injury
Description
Retrieves the classification and estimated mortality risk for the Abbreviated Injury Score (AIS) for Inhalation Injury. This scoring system grades the severity of inhalation injury based on bronchoscopic findings, ranging from Grade 0 (No injury) to Grade 4 (Massive injury).
Usage
ais_inhalation(grade)
Arguments
grade |
Numeric. The bronchoscopic grade of injury (0, 1, 2, 3, or 4). |
Value
A list containing:
Grade |
The input grade. |
Classification |
Description of the bronchoscopic findings associated with the grade. |
Estimated_Mortality |
Approximate mortality risk associated with the grade, based on Endorf and Gamelli (2007). |
References
Endorf FW, Gamelli RL. Inhalation injury, pulmonary complications, and mortality. J Burn Care Res. 2007;28(1):80-83. doi:10.1097/BCR.0B013E31802C889F
Examples
# Example 1: Moderate Injury
# Patient with moderate erythema and carbonaceous deposits
ais_inhalation(2)
# Example 2: Massive Injury
# Patient with mucosal sloughing and necrosis
ais_inhalation(4)
AKIN Classification for Acute Kidney Injury (AKI)
Description
Classifies the severity of Acute Kidney Injury (AKI) based on the Acute Kidney Injury Network (AKIN) criteria. The staging is determined by the worst of two criteria: serum creatinine changes (relative to baseline) or urine output duration.
Usage
akin_aki_staging(baseline_creatinine, max_creatinine,
urine_output_stage = 0, rrt_initiated = 0)
Arguments
baseline_creatinine |
Numeric. Baseline serum creatinine in mg/dL. |
max_creatinine |
Numeric. Maximum serum creatinine reached within 48 hours. |
urine_output_stage |
Numeric (0, 1, 2, or 3). The stage corresponding to the patient's urine output criteria. 0: Normal (> 0.5 ml/kg/hr). 1: < 0.5 ml/kg/hr for > 6 hours. 2: < 0.5 ml/kg/hr for > 12 hours. 3: < 0.3 ml/kg/hr for 24 hours OR Anuria for 12 hours. |
rrt_initiated |
Numeric (0 or 1). Was Renal Replacement Therapy (RRT) initiated? (1 = Yes, automatically Stage 3). |
Value
A list containing:
AKIN_Stage |
The final classification (No AKI, Stage 1, Stage 2, or Stage 3). |
Numeric_Stage |
Integer representation of the stage (0-3). |
Criteria_Met |
Breakdown of stages derived from Creatinine vs. Urine Output components. |
References
Mehta RL, Kellum JA, Shah SV, et al. Acute Kidney Injury Network: report of an initiative to improve outcomes in acute kidney injury. Crit Care. 2007;11(2):R31. doi:10.1186/cc5713
Examples
# Example 1: Stage 1 (Creatinine rise >= 0.3 mg/dL)
# Base 1.0, Max 1.3, Normal UO
akin_aki_staging(1.0, 1.3, 0, 0)
# Example 2: Stage 3 (Urine Output criteria)
# Base 1.0, Max 1.2 (No AKI by Cr), UO < 0.3 for 24h (Stage 3)
akin_aki_staging(1.0, 1.2, 3, 0)
Alberta Stroke Program Early CT Score (ASPECTS)
Description
Calculates the ASPECTS score to quantitate the severity of early ischemic changes on non-contrast CT scans in patients with acute ischemic stroke of the anterior circulation. The score starts at 10 and 1 point is subtracted for every region showing early ischemic changes. Lower scores indicate larger infarct volumes and poorer outcomes.
Usage
alberta_stroke_aspects(caudate, lentiform, internal_capsule, insular_cortex,
m1, m2, m3, m4, m5, m6)
Arguments
caudate |
Numeric (0 or 1). Early ischemic change in the Caudate nucleus? (1 = Yes, 0 = No). |
lentiform |
Numeric (0 or 1). Early ischemic change in the Lentiform nucleus? (1 = Yes, 0 = No). |
internal_capsule |
Numeric (0 or 1). Early ischemic change in the Internal Capsule? (1 = Yes, 0 = No). |
insular_cortex |
Numeric (0 or 1). Early ischemic change in the Insular Cortex? (1 = Yes, 0 = No). |
m1 |
Numeric (0 or 1). Early ischemic change in the "M1" region (Anterior MCA cortex)? (1 = Yes, 0 = No). |
m2 |
Numeric (0 or 1). Early ischemic change in the "M2" region (MCA cortex lateral to insular ribbon)? (1 = Yes, 0 = No). |
m3 |
Numeric (0 or 1). Early ischemic change in the "M3" region (Posterior MCA cortex)? (1 = Yes, 0 = No). |
m4 |
Numeric (0 or 1). Early ischemic change in the "M4" region (Anterior MCA territory superior to M1)? (1 = Yes, 0 = No). |
m5 |
Numeric (0 or 1). Early ischemic change in the "M5" region (Lateral MCA territory superior to M2)? (1 = Yes, 0 = No). |
m6 |
Numeric (0 or 1). Early ischemic change in the "M6" region (Posterior MCA territory superior to M3)? (1 = Yes, 0 = No). |
Value
A list containing:
ASPECTS_Value |
The final score (Range 0-10). |
Interpretation |
Prognostic grouping based on the score (e.g., Score < 8 correlates with poor outcome). |
References
Barber PA, Demchuk AM, Zhang J, Buchan AM. Validity and reliability of a quantitative computed tomography score in predicting outcome of hyperacute stroke before thrombolytic therapy. ASPECTS Study Group. Alberta Stroke Programme Early CT Score. Lancet. 2000;355(9216):1670-1674. doi:10.1016/s0140-6736(00)02237-6
Examples
# Example 1: Large Infarct (Score 6)
# Caudate, Lentiform, IC, and Insula involved
alberta_stroke_aspects(1, 1, 1, 1, 0, 0, 0, 0, 0, 0)
# Example 2: Normal CT (Score 10)
# No ischemic changes
alberta_stroke_aspects(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Calculate ALBI (Albumin-Bilirubin) Grade for HCC (Hepatocellular Carcinoma)
Description
Using non-SI/SI measurements of serum bilirubin and serum albumin, calculate the ALBI grade for patients with HCC. Developed by Johnson et al. 2015, an ALBI score of =<-2.60 is grade 1 with a median survival of 18.5-85.6 months, an ALBI score of -2.60 to (and including) -1.39 is grade 2 with a median survival of 5.3-46.5 months, and an ALBI score of >-1.39 is grade 3 with a median survival of 2.3-15.5 months. Validated by Hiroaka et al. 2017 and Chen et al. 2017.
Usage
albi(sbill, salb, units = "")
Arguments
sbill |
Numeric value of serum bilirubin in either non-SI (mg/dL) or SI (umol/ml). |
salb |
Numeric value of serum albumin in either non-SI (g/dL) or SI (g/L). |
units |
String to specify non-SI units by not including units argument or SI units by including units="SI". |
Value
A numeric value/vector with predicted ALBI score.
References
Johnson PJ, Berhane S, Kagebayashi C, et al. Assessment of liver function in patients with hepatocellular carcinoma: a new evidence-based approach-the ALBI grade. J Clin Oncol. 2015;33(6):550-558. doi:10.1200/JCO.2014.57.9151 Hiraoka A, Michitaka K, Kumada T, et al. Validation and Potential of Albumin-Bilirubin Grade and Prognostication in a Nationwide Survey of 46,681 Hepatocellular Carcinoma Patients in Japan: The Need for a More Detailed Evaluation of Hepatic Function. Liver Cancer. 2017;6(4):325-336. doi:10.1159/000479984 Chen B, Lin S. Albumin-bilirubin (ALBI) score at admission predicts possible outcomes in patients with acute-on-chronic liver failure. Medicine (Baltimore). 2017;96(24):e7142. doi:10.1097/MD.0000000000007142
Examples
# For non-SI measurements, the function is defined as
albi(1,3.7)
# For SI measurements, the function is defined as
albi(31,37, units = "SI")
Modified Aldrete Score for PACU Discharge
Description
Calculates the Modified Aldrete Score, a tool used to assess a patient's recovery from anesthesia and determine readiness for discharge from the Post-Anesthesia Care Unit (PACU). The modified version replaces the original "Color" component with "Oxygen Saturation".
Usage
aldrete_score(activity, respiration, circulation, consciousness, oxygenation)
Arguments
activity |
Numeric (0-2). 2: Able to move 4 extremities voluntarily or on command. 1: Able to move 2 extremities voluntarily or on command. 0: Able to move 0 extremities voluntarily or on command. |
respiration |
Numeric (0-2). 2: Able to breathe deeply and cough freely. 1: Dyspnea or limited breathing. 0: Apneic. |
circulation |
Numeric (0-2). Systemic Blood Pressure (BP) relative to pre-anesthetic level. 2: BP +/- 20 mmHg of pre-anesthetic level. 1: BP +/- 20-50 mmHg of pre-anesthetic level. 0: BP +/- >50 mmHg of pre-anesthetic level. |
consciousness |
Numeric (0-2). 2: Fully awake. 1: Arousable on calling. 0: Not responding. |
oxygenation |
Numeric (0-2). (Modified Aldrete component). 2: SpO2 > 92% on room air. 1: SpO2 > 90% with supplemental oxygen. 0: SpO2 < 90% with supplemental oxygen. |
Value
A list containing:
Total_Score |
The sum of the 5 components (Range 0-10). |
Interpretation |
Discharge readiness (Score >= 9 usually required). |
References
Aldrete JA. The post-anesthesia recovery score revisited. J Clin Anesth. 1995;7(1):89-91. doi:10.1016/0952-8180(94)00001-s
Examples
# Example 1: Ready for Discharge
# Moves 4 limbs (2), Deep breathing (2), BP within 20 (2), Awake (2), SpO2 >92% RA (2)
aldrete_score(2, 2, 2, 2, 2)
# Example 2: Not Ready
# Moves 2 limbs (1), Dyspneic (1), BP within 20 (2), Arousable (1), SpO2 >90% on O2 (1)
# Total = 6
aldrete_score(1, 1, 2, 1, 1)
Revised Amyotrophic Lateral Sclerosis Functional Rating Scale (ALSFRS-R)
Description
Calculates the ALSFRS-R score, a validated instrument for monitoring the progression of disability in patients with Amyotrophic Lateral Sclerosis (ALS). It evaluates four domains: Bulbar, Fine Motor, Gross Motor, and Respiratory function. Each of the 12 items is scored from 0 (Complete Loss of Function) to 4 (Normal Function), yielding a total score between 0 and 48.
Usage
alsfrs_r_score(speech, salivation, swallowing, handwriting, cutting_food,
dressing_hygiene, turning_in_bed, walking, climbing_stairs,
dyspnea, orthopnea, respiratory_insufficiency)
Arguments
speech |
Numeric (0-4). Assessment of speech processes. |
salivation |
Numeric (0-4). Assessment of salivation. |
swallowing |
Numeric (0-4). Assessment of swallowing. |
handwriting |
Numeric (0-4). Assessment of handwriting ability. |
cutting_food |
Numeric (0-4). Ability to cut food and handle utensils (with or without gastrostomy). |
dressing_hygiene |
Numeric (0-4). Ability to dress and perform hygiene. |
turning_in_bed |
Numeric (0-4). Ability to turn in bed and adjust bed clothes. |
walking |
Numeric (0-4). Walking ability. |
climbing_stairs |
Numeric (0-4). Ability to climb stairs. |
dyspnea |
Numeric (0-4). Shortness of breath. |
orthopnea |
Numeric (0-4). Shortness of breath while lying flat. |
respiratory_insufficiency |
Numeric (0-4). Use of respiratory appliances (BiPAP, Ventilator). |
Value
A list containing:
ALSFRS_R_Score |
The calculated total score (Range 0-48). |
Subscores |
Breakdown of scores by functional domain. |
Interpretation |
Context regarding the score directionality. |
References
Cedarbaum JM, Stambler N, Malta E, et al. The ALSFRS-R: a revised ALS functional rating scale that incorporates assessments of respiratory function. BDNF ALS Study Group (Phase III). J Neurol Sci. 1999;169(1-2):13-21. doi:10.1016/s0022-510x(99)00210-5
Examples
# Example 1: Mild Disease
# All normal except slight speech (3) and handwriting (3)
alsfrs_r_score(3, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4)
# Example 2: Advanced Disease
# Bulbar and Respiratory impairment
alsfrs_r_score(1, 2, 1, 0, 0, 0, 1, 0, 0, 2, 1, 0)
ALT-70 Score for Cellulitis
Description
Calculates the ALT-70 score to predict the likelihood of lower extremity cellulitis. This score helps differentiate true cellulitis from cellulitis mimics (pseudocellulitis) such as stasis dermatitis, which are often misdiagnosed and mistreated with antibiotics.
Usage
alt_70_cellulitis(asymmetry, leukocytosis, tachycardia, age_ge_70)
Arguments
asymmetry |
Numeric (0 or 1). Is the leg involvement unilateral? (1 = Yes/Asymmetric, 0 = No/Bilateral). Note: Bilateral involvement strongly suggests a mimic. (+3 points). |
leukocytosis |
Numeric (0 or 1). WBC >= 10,000/uL (or >= 10.0 k/uL). (1 = Yes, +1 point). |
tachycardia |
Numeric (0 or 1). Heart rate >= 90 bpm. (1 = Yes, +1 point). |
age_ge_70 |
Numeric (0 or 1). Age >= 70 years. (1 = Yes, +2 points). |
Value
A list containing:
Total_Score |
The calculated ALT-70 score (Range 0-7). |
Likelihood |
Estimated probability of true cellulitis. |
Recommendation |
Clinical guidance based on the score (e.g., Consider mimics vs. Treat). |
References
Raff AB, Weng QY, Cohen JM, et al. A predictive model for diagnosis of lower extremity cellulitis: A cross-sectional study. J Am Acad Dermatol. 2017;76(4):618-625.e2. doi:10.1016/j.jaad.2016.12.044
Examples
# Example 1: High Likelihood
# Unilateral leg redness (+3), HR 95 (+1), Age 75 (+2), Normal WBC (0)
# Score = 6
alt_70_cellulitis(1, 0, 1, 1)
# Example 2: Low Likelihood (Likely Stasis Dermatitis)
# Bilateral redness (0), Age 65 (0), No systemic signs
# Score = 0
alt_70_cellulitis(0, 0, 0, 0)
Altitude-Adjusted PERC Rule for Pulmonary Embolism
Description
Applies the Pulmonary Embolism Rule-out Criteria (PERC) with an adjustment for high altitude. Standard PERC requires an oxygen saturation (SaO2) >= 95%. The Altitude-Adjusted PERC lowers this threshold to >= 90% to account for the physiological hypoxia associated with higher elevations, maintaining specificity while preventing unnecessary imaging.
Usage
altitude_adjusted_perc(age, heart_rate, o2_sat, hemoptysis, estrogen_use,
surgery_trauma_4wks, prior_vte, unilateral_leg_swelling)
Arguments
age |
Numeric. Patient age in years. (Criteria met if < 50). |
heart_rate |
Numeric. Heart rate in bpm. (Criteria met if < 100). |
o2_sat |
Numeric. Oxygen saturation in %. (Criteria met if >= 90% for altitude adjustment; Standard is 95%). |
hemoptysis |
Numeric (0 or 1). Presence of hemoptysis. (Criteria met if 0). |
estrogen_use |
Numeric (0 or 1). Exogenous estrogen use (OCPs, HRT, etc.). (Criteria met if 0). |
surgery_trauma_4wks |
Numeric (0 or 1). Recent surgery or trauma requiring hospitalization within 4 weeks. (Criteria met if 0). |
prior_vte |
Numeric (0 or 1). Prior history of DVT or PE. (Criteria met if 0). |
unilateral_leg_swelling |
Numeric (0 or 1). Unilateral leg swelling. (Criteria met if 0). |
Value
A list containing:
Result |
"PERC Negative" (Rule Out) or "PERC Positive" (Cannot Rule Out). |
Recommendation |
Guidance on the need for further testing (e.g., D-dimer). |
Criteria_Violated |
List of specific criteria that failed the rule-out. |
References
Madsen T, et al. Prospective validation of the pulmonary embolism rule-out criteria at high altitude. Am J Emerg Med. 2020.
Examples
# Example 1: Negative Rule Out (High Altitude Context)
# 45yo, HR 90, O2 91% (Passes altitude cutoff), No other risks
altitude_adjusted_perc(45, 90, 91, 0, 0, 0, 0, 0)
# Example 2: Positive Rule Out (Fails O2)
# 45yo, HR 90, O2 88% (Fails even adjusted cutoff)
altitude_adjusted_perc(45, 90, 88, 0, 0, 0, 0, 0)
Alvarado Score for Acute Appendicitis
Description
Calculates the Alvarado Score (also known as the MANTRELS score) to stratify the risk of acute appendicitis in patients presenting with abdominal pain. The score uses clinical symptoms, physical exam findings, and laboratory values to categorize patients into Low, Moderate, or High risk groups, helping to guide decisions regarding imaging (CT) and surgical consultation.
Usage
alvarado_appendicitis(migratory_pain, anorexia, nausea_vomiting, rlq_tenderness,
rebound_tenderness, elevated_temp, leukocytosis, shift_left)
Arguments
migratory_pain |
Numeric (0 or 1). Migration of pain to the right lower quadrant. (1 = Yes, +1 point). |
anorexia |
Numeric (0 or 1). Anorexia or ketones in urine. (1 = Yes, +1 point). |
nausea_vomiting |
Numeric (0 or 1). Nausea or vomiting. (1 = Yes, +1 point). |
rlq_tenderness |
Numeric (0 or 1). Tenderness in the right lower quadrant. (1 = Yes, +2 points). |
rebound_tenderness |
Numeric (0 or 1). Rebound tenderness. (1 = Yes, +1 point). |
elevated_temp |
Numeric (0 or 1). Temperature >= 37.3 C (99.1 F). (1 = Yes, +1 point). |
leukocytosis |
Numeric (0 or 1). Leukocytosis > 10,000 /uL. (1 = Yes, +2 points). |
shift_left |
Numeric (0 or 1). Shift to the left (neutrophils > 75%). (1 = Yes, +1 point). |
Value
A list containing:
Total_Score |
The sum of the weighted criteria (Range 0-10). |
Risk_Group |
Risk classification (Low 0-3, Moderate 4-6, High 7-10). |
Recommendation |
Clinical guidance based on the risk group. |
References
Alvarado A. A practical score for the early diagnosis of acute appendicitis. Ann Emerg Med. 1986;15(5):557-564. doi:10.1016/s0196-0644(86)80993-3
Examples
# Example 1: High Risk (Surgical Candidate)
# Migratory pain, Nausea, RLQ Tenderness (2), Rebound, Fever, Leukocytosis (2)
# Score = 1 + 1 + 2 + 1 + 1 + 2 = 8
alvarado_appendicitis(1, 0, 1, 1, 1, 1, 1, 0)
# Example 2: Low Risk
# Nausea only
# Score = 1
alvarado_appendicitis(0, 0, 1, 0, 0, 0, 0, 0)
Antivenom Dosing Algorithm (CroFab)
Description
Determines the recommended dosing for CroFab antivenom in patients with North American Crotalid (pit viper) envenomation. The algorithm guides the initial dose to achieve control of symptoms (arrest of local progression, normalization of coagulopathy, and resolution of systemic signs) and subsequent maintenance therapy.
Usage
antivenom_dosing_algorithm(signs_of_envenomation, initial_control_achieved = FALSE)
Arguments
signs_of_envenomation |
Numeric (0 or 1). Presence of signs of envenomation (swelling, tenderness, ecchymosis, coagulopathy, or systemic signs). (1 = Yes, 0 = No). |
initial_control_achieved |
Numeric (0 or 1). Has initial control been achieved? defined as the arrest of local progression, improvement in systemic signs, and stabilization of coagulation labs. (1 = Yes, 0 = No). |
Value
A list containing:
Recommendation |
Guidance on initial or repeat dosing. |
Maintenance_Therapy |
Instructions for maintenance doses if control is achieved. |
References
Lavonas EJ, Ruha AM, Banner W, et al. Unified treatment algorithm for the management of crotaline snakebite in the United States: results of an evidence-informed consensus workshop. BMC Emerg Med. 2011;11:2. doi:10.1186/1471-227X-11-2
Examples
# Example 1: Initial Presentation
# Patient with swelling and pain
antivenom_dosing_algorithm(1, 0)
# Example 2: Control Achieved
# Patient received initial dose, swelling stopped, labs stable
antivenom_dosing_algorithm(1, 1)
# Example 3: Dry Bite
# No signs of envenomation
antivenom_dosing_algorithm(0, 0)
Aortic Dissection Detection Risk Score (ADD-RS)
Description
Calculates the ADD-RS to stratify the pre-test probability of acute aortic dissection. The score is based on the presence of features in three categories: Predisposing Conditions, Pain Features, and Physical Exam Findings. The presence of any feature in a category awards 1 point, for a maximum score of 3.
Usage
aortic_dissection_detection_risk_score(high_risk_conditions,
high_risk_pain, high_risk_exam)
Arguments
high_risk_conditions |
Numeric (0 or 1). Presence of any high-risk condition: Marfan syndrome, connective tissue disease, family history of aortic disease, known aortic valve disease, recent aortic manipulation, or known thoracic aortic aneurysm. (1 = Present). |
high_risk_pain |
Numeric (0 or 1). Presence of any high-risk pain feature: Abrupt onset, severe intensity, or ripping/tearing sensation. (1 = Present). |
high_risk_exam |
Numeric (0 or 1). Presence of any high-risk exam feature: Pulse deficit, systolic BP differential, focal neurological deficit (with pain), new aortic insufficiency murmur, or hypotension/shock. (1 = Present). |
Value
A list containing:
ADD_RS_Score |
The calculated score (Range 0-3). |
Risk_Category |
Risk classification (Low = 0, Moderate = 1, High = 2-3). |
Recommendation |
Guidance on workup (D-dimer vs. Imaging) based on AHA/ACC guidelines. |
References
Rogers AM, Hermann LK, Booher AM, et al. Sensitivity of the aortic dissection detection risk score, a novel guideline-based tool for identification of acute aortic dissection at initial presentation: results from the international registry of acute aortic dissection. Circulation. 2011;123(20):2213-2218. doi:10.1161/CIRCULATIONAHA.110.988568
Examples
# Example 1: High Risk
# Patient with Marfan syndrome (Conditions=1) and Ripping chest pain (Pain=1)
aortic_dissection_detection_risk_score(1, 1, 0)
# Example 2: Low Risk
# No high risk features present
aortic_dissection_detection_risk_score(0, 0, 0)
APACHE II Score
Description
Calculates the Acute Physiology and Chronic Health Evaluation II (APACHE II) Score. This severity-of-disease classification system is used to estimate in-hospital mortality for adult patients admitted to the Intensive Care Unit (ICU). The score is calculated based on 12 physiological measurements, age, and chronic health status measured within the first 24 hours of ICU admission.
Usage
apache_ii_score(age, temperature_c, mean_arterial_pressure, heart_rate,
respiratory_rate, fio2, pao2, paco2 = NULL, arterial_ph,
sodium, potassium, creatinine, acute_renal_failure,
hematocrit, wbc_count, gcs_total, chronic_organ_insufficiency,
admission_type)
Arguments
age |
Numeric. Patient age in years. |
temperature_c |
Numeric. Rectal temperature in degrees Celsius. |
mean_arterial_pressure |
Numeric. Mean Arterial Pressure (MAP) in mmHg. |
heart_rate |
Numeric. Heart rate in bpm. |
respiratory_rate |
Numeric. Respiratory rate in breaths/min. |
fio2 |
Numeric. Fraction of Inspired Oxygen (0.21 - 1.0). |
pao2 |
Numeric. Arterial partial pressure of oxygen (mmHg). |
paco2 |
Numeric (Optional). Arterial partial pressure of carbon dioxide (mmHg). Required only if FiO2 >= 0.5 for A-a gradient calculation. |
arterial_ph |
Numeric. Arterial pH. |
sodium |
Numeric. Serum sodium in mEq/L. |
potassium |
Numeric. Serum potassium in mEq/L. |
creatinine |
Numeric. Serum creatinine in mg/dL. |
acute_renal_failure |
Numeric (0 or 1). Presence of Acute Renal Failure (Doubles the creatinine points). (1 = Yes, 0 = No). |
hematocrit |
Numeric. Hematocrit percentage (e.g., 40 for 40%). |
wbc_count |
Numeric. White Blood Cell count in x1000/mm3 (e.g., 10 for 10,000). |
gcs_total |
Numeric. Total Glasgow Coma Scale (3-15). |
chronic_organ_insufficiency |
Numeric (0 or 1). History of severe organ insufficiency (liver, CV, resp, renal) or immunocompromised state. (1 = Yes, 0 = No). |
admission_type |
String. Type of ICU admission. Options: "non_operative", "emergency_postop", "elective_postop". |
Value
A list containing:
APACHE_II_Score |
The calculated severity score (Range 0-71). |
Est_Hospital_Mortality |
Approximate mortality percentage based on Knaus et al. (1985). |
References
Knaus WA, Draper EA, Wagner DP, Zimmerman JE. APACHE II: a severity of disease classification system. Crit Care Med. 1985;13(10):818-829.
Examples
# Example 1: Critical Patient (High Score)
# 75yo, Temp 39, MAP 50, HR 140, RR 35, PaO2 50 (FiO2 0.4), pH 7.2, Na 130, K 6.0,
# Cr 2.0 (ARF), Hct 25, WBC 25, GCS 10, Chronic organ failure (Non-op)
apache_ii_score(75, 39, 50, 140, 35, 0.4, 50, NULL, 7.2,
130, 6.0, 2.0, 1, 25, 25, 10, 1, "non_operative")
# Example 2: Stable Post-Op
# 50yo, Normal vitals/labs, GCS 15, No chronic health issues, Elective surgery
apache_ii_score(50, 37, 90, 80, 16, 0.21, 90, NULL,
7.4, 140, 4.0, 1.0, 0, 40, 8, 15, 0, "elective_postop")
Apfel Score for Postoperative Nausea and Vomiting
Description
Calculates the Apfel Score to estimate the risk of Postoperative Nausea and Vomiting (PONV) in adult patients undergoing inhalational anesthesia. The score ranges from 0 to 4, with each risk factor adding approximately 20% to the baseline risk.
Usage
apfel_ponv(female_sex, history_ponv_motion_sickness, non_smoker, postop_opioids)
Arguments
female_sex |
Numeric (0 or 1). Patient is female. (1 = Yes, +1 point). |
history_ponv_motion_sickness |
Numeric (0 or 1). History of PONV or motion sickness. (1 = Yes, +1 point). |
non_smoker |
Numeric (0 or 1). Patient is a non-smoker. (1 = Yes, +1 point). |
postop_opioids |
Numeric (0 or 1). Expected use of postoperative opioids. (1 = Yes, +1 point). |
Value
A list containing:
Apfel_Score |
The total number of risk factors present (Range 0-4). |
Est_Risk_PONV |
The estimated probability of PONV (10%, 21%, 39%, 61%, or 79%). |
References
Apfel CC, Laara E, Koivuranta M, Greim CA, Roewer N. A simplified risk score for predicting postoperative nausea and vomiting: conclusions from cross-validations between two centers. Anesthesiology. 1999;91(3):693-700. doi:10.1097/00000542-199909000-00022
Examples
# Example 1: High Risk
# Female, History of Motion Sickness, Non-Smoker, Getting Opioids
# Score = 4 (79% Risk)
apfel_ponv(1, 1, 1, 1)
# Example 2: Low Risk
# Male, Smoker, No Hx, No Opioids
# Score = 0 (10% Risk)
apfel_ponv(0, 0, 0, 0)
APGAR Score for Newborns
Description
Calculates the APGAR score, a rapid method for assessing the clinical status of a newborn at 1 and 5 minutes after birth. The score evaluates five criteria: Appearance, Pulse, Grimace, Activity, and Respiration.
Usage
apgar_score(appearance, pulse, grimace, activity, respiration)
Arguments
appearance |
Numeric (0-2). Skin Color. 0: Blue or pale all over. 1: Acrocyanosis (body pink, extremities blue). 2: Completely pink. |
pulse |
Numeric (0-2). Heart Rate. 0: Absent. 1: < 100 bpm. 2: > 100 bpm. |
grimace |
Numeric (0-2). Reflex Irritability (response to stimulation). 0: No response. 1: Grimace. 2: Cry or active withdrawal. |
activity |
Numeric (0-2). Muscle Tone. 0: Limp/Flaccid. 1: Some flexion. 2: Active motion. |
respiration |
Numeric (0-2). Respiratory Effort. 0: Absent. 1: Slow, irregular, or weak cry. 2: Good, vigorous cry. |
Value
A list containing:
Total_Score |
The sum of the five components (Range 0-10). |
Interpretation |
General assessment (Reassuring, Moderately Abnormal, or Low). |
References
Apgar V. A proposal for a new method of evaluation of the newborn infant. Curr Res Anesth Analg. 1953;32(4):260-267.
Examples
# Example 1: Healthy Newborn
# Pink body/blue limbs (1), HR >100 (2), Cry (2), Active (2), Good cry (2)
# Score = 9
apgar_score(1, 2, 2, 2, 2)
# Example 2: Distressed Newborn
# Blue (0), HR <100 (1), Grimace (1), Flaccid (0), Irregular resp (1)
# Score = 3
apgar_score(0, 1, 1, 0, 1)
Calculate APRI (AST to Platelet Ratio)
Description
Using aspartate aminotransferase and platelet values, calculate the APRI index, devised by Wait et al 2003, estimates hepatic fibrosis and cirrhosis in patients with hepatitis C. APRI value <0.7 is indicative of little to no evidence of fibrosis, 0.7-1.0 is moderate fibrosis, and 1.0+ is evidence of cirrhosis and significant fibrosis, as validated by Khan et al. 2008 and Lin et al 2011.
Usage
apri(ast, plt)
Arguments
ast |
Numeric value of aspartate aminotransferase in U/L. |
plt |
Numeric value of platelets in 10^3/uL or 10^9/L. |
Value
A numeric value/vector with predicted APRI index score.
References
Wai CT, Greenson JK, Fontana RJ, et al. A simple noninvasive index can predict both significant fibrosis and cirrhosis in patients with chronic hepatitis C. Hepatology. 2003;38(2):518-526. doi:10.1053/jhep.2003.50346 Khan DA, Fatima-Tuz-Zuhra, Khan FA, Mubarak A. Evaluation of diagnostic accuracy of APRI for prediction of fibrosis in hepatitis C patients. J Ayub Med Coll Abbottabad. 2008;20(4):122-126. Lin, Z.-H., Xin, Y.-N., Dong, Q.-J., Wang, Q., Jiang, X.-J., Zhan, S.-H., Sun, Y. and Xuan, S.-Y. (2011), Performance of the aspartate aminotransferase-to-platelet ratio index for the staging of hepatitis C-related fibrosis: An updated meta-analysis. Hepatology, 53: 726-736. https://doi.org/10.1002/hep.24105
Examples
# The function is defined as
apri(16,150)
ARISCAT Score for Postoperative Pulmonary Complications
Description
Calculates the ARISCAT (Assess Respiratory Risk in Surgical Patients in Catalonia) score to predict the risk of developing postoperative pulmonary complications (PPC) such as respiratory failure, infection, pleural effusion, atelectasis, pneumothorax, bronchospasm, or aspiration pneumonitis.
Usage
ariscat_score(age, spo2, resp_infection_last_month, anemia_hb_le_10,
incision_site, duration_surgery_hours, emergency_surgery)
Arguments
age |
Numeric. Patient age in years. |
spo2 |
Numeric. Preoperative oxygen saturation (%) on room air. |
resp_infection_last_month |
Numeric (0 or 1). Respiratory infection within the last month. (1 = Yes). |
anemia_hb_le_10 |
Numeric (0 or 1). Preoperative anemia with Hemoglobin <= 10 g/dL. (1 = Yes). |
incision_site |
String. Location of surgical incision. Options: "peripheral" (0 pts), "upper_abdominal" (15 pts), "intrathoracic" (24 pts). |
duration_surgery_hours |
Numeric. Expected or actual duration of surgery in hours. |
emergency_surgery |
Numeric (0 or 1). Is the procedure an emergency? (1 = Yes). |
Value
A list containing:
ARISCAT_Score |
The calculated score (Range 0-123). |
Risk_Group |
Risk classification (Low < 26, Intermediate 26-44, High >= 45). |
Est_Pulmonary_Complication_Rate |
Estimated percentage risk of PPCs. |
References
Canet J, Gallart L, Gomar C, et al. Prediction of postoperative pulmonary complications in a population-based surgical cohort. Anesthesiology. 2010;113(6):1338-1350. doi:10.1097/ALN.0b013e3181fc6e0a
Examples
# Example 1: High Risk
# 82yo, SpO2 90%, Intrathoracic, >3h surgery
# Score = 16 + 24 + 0 + 0 + 24 + 23 + 0 = 87
ariscat_score(82, 90, 0, 0, "intrathoracic", 3.5, 0)
# Example 2: Low Risk
# 45yo, SpO2 98%, Peripheral, 1h surgery
# Score = 0
ariscat_score(45, 98, 0, 0, "peripheral", 1, 0)
ASA Physical Status Classification System
Description
Retrieves the definition and examples for the American Society of Anesthesiologists (ASA) Physical Status Classification System. This system is used to assess the fitness of patients before surgery.
Usage
asa_physical_status(asa_class, emergency = 0)
Arguments
asa_class |
Numeric (1-6). The ASA Physical Status Class. 1: Normal healthy patient. 2: Mild systemic disease. 3: Severe systemic disease. 4: Severe systemic disease that is a constant threat to life. 5: Moribund patient not expected to survive without operation. 6: Declared brain-dead patient for organ donation. |
emergency |
Numeric (0 or 1). Is the procedure an emergency? (1 = Yes). Adds the "E" suffix to the classification. |
Value
A list containing:
Classification |
The formatted classification string (e.g., "ASA III-E"). |
Definition |
The official definition of the class. |
Examples |
Common adult clinical examples corresponding to the class. |
Emergency_Status |
Boolean indicating if the procedure is emergent. |
References
ASA House of Delegates/Executive Committee. ASA Physical Status Classification System. American Society of Anesthesiologists. Last amended 2020.
Examples
# Example 1: Healthy Patient
asa_physical_status(1, 0)
# Example 2: Emergency Surgery for High Risk Patient
# ASA IV (Severe systemic disease, threat to life)
asa_physical_status(4, 1)
ASAS Criteria for Axial Spondyloarthritis (SpA)
Description
Applies the Assessment of SpondyloArthritis international Society (ASAS) classification criteria for axial spondyloarthritis. These criteria are applicable to patients with back pain for >= 3 months and age of onset < 45 years. Classification is achieved through either the "Imaging Arm" (Sacroiliitis + >=1 SpA feature) or the "Clinical Arm" (HLA-B27 + >=2 other SpA features).
Usage
asas_axial_spa(back_pain_gt_3mo, age_onset_lt_45, sacroiliitis_imaging, hla_b27,
inflammatory_bp, arthritis, enthesitis_heel, uveitis, dactylitis,
psoriasis, crohns_colitis, good_nsaid_response, family_history_spa,
elevated_crp_esr)
Arguments
back_pain_gt_3mo |
Numeric (0 or 1). Back pain duration >= 3 months. (Entry Criterion). |
age_onset_lt_45 |
Numeric (0 or 1). Age at onset of back pain < 45 years. (Entry Criterion). |
sacroiliitis_imaging |
Numeric (0 or 1). Active (acute) inflammation on MRI highly suggestive of sacroiliitis associated with SpA, OR definite radiographic sacroiliitis according to modified New York criteria. |
hla_b27 |
Numeric (0 or 1). Positive HLA-B27 status. |
inflammatory_bp |
Numeric (0 or 1). History of inflammatory back pain. |
arthritis |
Numeric (0 or 1). Arthritis (past or present). |
enthesitis_heel |
Numeric (0 or 1). Enthesitis (heel). |
uveitis |
Numeric (0 or 1). Uveitis (past or present). |
dactylitis |
Numeric (0 or 1). Dactylitis (past or present). |
psoriasis |
Numeric (0 or 1). Psoriasis (past or present). |
crohns_colitis |
Numeric (0 or 1). Crohn's disease or ulcerative colitis (past or present). |
good_nsaid_response |
Numeric (0 or 1). Good response to NSAIDs (back pain relief within 24-48h). |
family_history_spa |
Numeric (0 or 1). Family history for SpA (in first- or second-degree relative). |
elevated_crp_esr |
Numeric (0 or 1). Elevated CRP or ESR (after exclusion of other causes). |
Value
A list containing:
Classification |
"Classified as Axial Spondyloarthritis", "Not Classified", or "Not Applicable". |
Criteria_Arm_Met |
Indicates if the patient met the "Imaging Arm", "Clinical Arm", or "Both". |
References
Rudwaleit M, van der Heijde D, Landewé R, et al. The development of Assessment of SpondyloArthritis international Society classification criteria for axial spondyloarthritis (part II): validation and final selection. Ann Rheum Dis. 2009;68(6):777-783. doi:10.1136/ard.2009.108233
Examples
# Example 1: Imaging Arm
# Entry criteria met, Sacroiliitis present, Inflammatory BP present
asas_axial_spa(1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
# Example 2: Clinical Arm
# Entry criteria met, No imaging findings, HLA-B27 Positive,
# Uveitis present, Family History present (2 clinical features)
asas_axial_spa(1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0)
ASAS Criteria for Peripheral Spondyloarthritis (SpA)
Description
Applies the Assessment of SpondyloArthritis international Society (ASAS) classification criteria for peripheral spondyloarthritis. These criteria are applicable to patients with peripheral arthritis, enthesitis, or dactylitis. Classification is achieved if the patient has at least one specific SpA feature (Group 1) OR at least two other SpA features (Group 2).
Usage
asas_peripheral_spa(arthritis, enthesitis, dactylitis, uveitis, psoriasis,
crohns_colitis, preceding_infection, hla_b27,
sacroiliitis_imaging, inflammatory_bp, family_history_spa)
Arguments
arthritis |
Numeric (0 or 1). Peripheral arthritis (Entry Criterion). |
enthesitis |
Numeric (0 or 1). Enthesitis (Entry Criterion). |
dactylitis |
Numeric (0 or 1). Dactylitis (Entry Criterion). |
uveitis |
Numeric (0 or 1). Uveitis (past or present). (Group 1 Feature). |
psoriasis |
Numeric (0 or 1). Psoriasis (past or present). (Group 1 Feature). |
crohns_colitis |
Numeric (0 or 1). Crohn's disease or ulcerative colitis (past or present). (Group 1 Feature). |
preceding_infection |
Numeric (0 or 1). Preceding infection (urethritis/cervicitis or diarrhea within 1 month before arthritis). (Group 1 Feature). |
hla_b27 |
Numeric (0 or 1). Positive HLA-B27 status. (Group 1 Feature). |
sacroiliitis_imaging |
Numeric (0 or 1). Sacroiliitis on imaging (MRI or X-ray). (Group 1 Feature). |
inflammatory_bp |
Numeric (0 or 1). History of inflammatory back pain. (Group 2 Feature). |
family_history_spa |
Numeric (0 or 1). Family history for SpA (in first- or second-degree relative). (Group 2 Feature). |
Value
A list containing:
Classification |
"Classified as Peripheral Spondyloarthritis", "Not Classified", or "Not Applicable". |
Criteria_Met |
Indicates which criteria set was satisfied (Group 1 or Group 2). |
References
Rudwaleit M, van der Heijde D, Landewé R, et al. The Assessment of SpondyloArthritis international Society classification criteria for peripheral spondyloarthritis and for spondyloarthritis in general. Ann Rheum Dis. 2011;70(1):25-31. doi:10.1136/ard.2010.133645
Examples
# Example 1: Group 1 Met
# Arthritis (Entry), Psoriasis (Group 1)
asas_peripheral_spa(1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0)
# Example 2: Group 2 Met
# Enthesitis (Entry + Group 2), Family History (Group 2)
# Total Group 2 count = 2
asas_peripheral_spa(0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1)
ASCOD Phenotyping for Ischemic Stroke
Description
Generates the ASCOD phenotype string for ischemic stroke characterization. The ASCOD classification system characterizes stroke based on the presence and likelihood of five underlying pathologies: Atherosclerosis (A), Small vessel disease (S), Cardiac pathology (C), Other causes (O), and Dissection (D). Each category is graded based on the strength of the causal link.
Usage
ascod_stroke_phenotype(a_grade, s_grade, c_grade, o_grade, d_grade)
Arguments
a_grade |
Numeric (0, 1, 2, 3, or 9). Grade for Atherosclerosis. |
s_grade |
Numeric (0, 1, 2, 3, or 9). Grade for Small Vessel Disease. |
c_grade |
Numeric (0, 1, 2, 3, or 9). Grade for Cardiac Pathology. |
o_grade |
Numeric (0, 1, 2, 3, or 9). Grade for Other Causes. |
d_grade |
Numeric (0, 1, 2, 3, or 9). Grade for Dissection. |
Details
Grading Key: 1: Potential Cause (Disease present and potentially causal). 2: Uncertain Cause (Disease present but causal link uncertain). 3: Unlikely Cause (Disease present but unlikely to be the cause). 0: Absent (No disease found). 9: Insufficient Workup (Grading not possible).
Value
A list containing:
ASCOD_Phenotype |
The formatted phenotype string (e.g., "A1-S3-C0-O9-D0"). |
Interpretation |
A breakdown of the clinical significance for each category. |
References
Amarenco P, Bogousslavsky J, Caplan LR, Donnan GA, Hennerici MG. The ASCOD phenotyping of ischemic stroke (Updated ASCOD I). Cerebrovasc Dis. 2013;36(1):1-5. doi:10.1159/000352050
Examples
# Example 1: Cardioembolic Stroke
# Atherosclerosis absent (0), Small vessel unlikely (3),
# Cardiac potential (1), Other insuff (9), Dissection absent (0)
ascod_stroke_phenotype(0, 3, 1, 9, 0)
# Example 2: Mixed Etiology
# Atherosclerosis potential (1), Small vessel potential (1), others absent
ascod_stroke_phenotype(1, 1, 0, 0, 0)
ASCVD Risk Estimator (2013 ACC/AHA Guidelines)
Description
Calculates the 10-year estimated risk of atherosclerotic cardiovascular disease (ASCVD) events (fatal/non-fatal MI or Stroke) using the 2013 ACC/AHA Pooled Cohort Equations. The calculator is valid for adults aged 40-79 without existing cardiovascular disease.
Usage
ascvd_2013_risk_calculator(age, sex, race, total_cholesterol, hdl_cholesterol,
systolic_bp, bp_medication, diabetes, smoker)
Arguments
age |
Numeric. Patient age in years (Valid range: 40-79). |
sex |
String. Patient sex ("Male" or "Female"). |
race |
String. Patient race ("White", "African American", or "Other"). Note: "Other" uses the White coefficients as per guideline recommendation. |
total_cholesterol |
Numeric. Total Cholesterol in mg/dL. |
hdl_cholesterol |
Numeric. HDL Cholesterol in mg/dL. |
systolic_bp |
Numeric. Systolic Blood Pressure in mmHg. |
bp_medication |
Numeric (0 or 1). Is the patient taking medication for high blood pressure? (1 = Yes, 0 = No). |
diabetes |
Numeric (0 or 1). Does the patient have diabetes? (1 = Yes, 0 = No). |
smoker |
Numeric (0 or 1). Is the patient a current smoker? (1 = Yes, 0 = No). |
Value
A list containing:
Ten_Year_ASCVD_Risk_Percent |
The estimated 10-year risk percentage. |
Risk_Category |
Classification (Low, Borderline, Intermediate, High). |
Recommendation |
Guidance on statin therapy initiation based on the 2018 Guideline on the Management of Blood Cholesterol update to these risk categories. |
References
Goff DC Jr, Lloyd-Jones DM, Bennett G, et al. 2013 ACC/AHA guideline on the assessment of cardiovascular risk: a report of the American College of Cardiology/American Heart Association Task Force on Practice Guidelines. Circulation. 2014;129(25 Suppl 2):S49-73. doi:10.1161/01.cir.0000437741.48606.98
Examples
# Example 1: High Risk
# 65yo Male, AfrAm, TotChol 200, HDL 40, SBP 150 (Treated), Smoker, Diabetes
ascvd_2013_risk_calculator(65, "male", "aa", 200, 40, 150, 1, 1, 1)
# Example 2: Low Risk
# 45yo Female, White, TotChol 170, HDL 60, SBP 110 (Untreated), Non-Smoker, No DM
ascvd_2013_risk_calculator(45, "female", "white", 170, 60, 110, 0, 0, 0)
Ankylosing Spondylitis Disease Activity Score with CRP (ASDAS-CRP)
Description
Calculates the ASDAS-CRP score, a composite index to assess disease activity in patients with Ankylosing Spondylitis (AS). It combines patient-reported outcomes (Back Pain, Morning Stiffness, Global Assessment, Peripheral Pain) with an objective inflammatory marker (CRP).
Usage
asdas_crp(back_pain, duration_morning_stiffness, patient_global,
peripheral_pain_swelling, crp_mg_l)
Arguments
back_pain |
Numeric (0-10). Severity of back pain (BASDAI Question 2). |
duration_morning_stiffness |
Numeric (0-10). Duration of morning stiffness (BASDAI Question 6). |
patient_global |
Numeric (0-10). Patient global assessment of disease activity. |
peripheral_pain_swelling |
Numeric (0-10). Severity of peripheral pain/swelling (BASDAI Question 3). |
crp_mg_l |
Numeric. C-Reactive Protein level in mg/L. (Note: If CRP < 2 mg/L, it is set to 2 for calculation). |
Value
A list containing:
ASDAS_CRP_Score |
The calculated score. |
Disease_Activity_State |
Classification (Inactive < 1.3, Moderate < 2.1, High <= 3.5, Very High > 3.5). |
References
Lukas C, Landewe R, Sieper J, et al. Development of an ASAS-endorsed disease activity score for ankylosing spondylitis (ASDAS). Ann Rheum Dis. 2009;68(1):18-24. doi:10.1136/ard.2008.094870
Examples
# Example 1: High Disease Activity
# Back Pain 6, Stiffness 5, Global 6, Peripheral 4, CRP 10
asdas_crp(6, 5, 6, 4, 10)
# Example 2: Inactive Disease
# All scores 1, CRP 1.0
asdas_crp(1, 1, 1, 1, 1)
Ankylosing Spondylitis Disease Activity Score with ESR (ASDAS-ESR)
Description
Calculates the ASDAS-ESR score, a composite index to assess disease activity in patients with Ankylosing Spondylitis (AS). It combines patient-reported outcomes (Back Pain, Morning Stiffness, Global Assessment, Peripheral Pain) with the Erythrocyte Sedimentation Rate (ESR).
Usage
asdas_esr(back_pain, duration_morning_stiffness, patient_global,
peripheral_pain_swelling, esr_mm_hr)
Arguments
back_pain |
Numeric (0-10). Severity of back pain (BASDAI Question 2). |
duration_morning_stiffness |
Numeric (0-10). Duration of morning stiffness (BASDAI Question 6). |
patient_global |
Numeric (0-10). Patient global assessment of disease activity. |
peripheral_pain_swelling |
Numeric (0-10). Severity of peripheral pain/swelling (BASDAI Question 3). |
esr_mm_hr |
Numeric. Erythrocyte Sedimentation Rate in mm/hr. |
Value
A list containing:
ASDAS_ESR_Score |
The calculated score. |
Disease_Activity_State |
Classification (Inactive < 1.3, Moderate < 2.1, High <= 3.5, Very High > 3.5). |
References
Lukas C, Landewe R, Sieper J, et al. Development of an ASAS-endorsed disease activity score for ankylosing spondylitis (ASDAS). Ann Rheum Dis. 2009;68(1):18-24. doi:10.1136/ard.2008.094870
Examples
# Example 1: High Disease Activity
# Back Pain 6, Stiffness 5, Global 6, Peripheral 4, ESR 25
asdas_esr(6, 5, 6, 4, 25)
# Example 2: Inactive Disease
# All scores 1, ESR 5
asdas_esr(1, 1, 1, 1, 5)
ASSURE Renal Cell Carcinoma Prognosis
Description
Calculates the prognostic risk group (Low, Intermediate, High) for Disease-Free Survival (DFS) and Overall Survival (OS) in patients with resected intermediate- or high-risk localized Renal Cell Carcinoma (RCC). This model is based on data from the ASSURE (E2805) clinical trial and incorporates histology, grade, necrosis, and vascular invasion.
Usage
assure_rcc_prognosis(histology, fuhrman_grade, tumor_size_cm, necrosis,
vascular_invasion, nodal_involvement, sarcomatoid)
Arguments
histology |
String. Histological subtype: "clear cell", "papillary type 1", "papillary type 2", "chromophobe", "mixed", or "other". |
fuhrman_grade |
Numeric (1-4). Fuhrman nuclear grade. |
tumor_size_cm |
Numeric. Maximum tumor diameter in centimeters. |
necrosis |
Numeric (0 or 1). Presence of coagulative tumor necrosis. (1 = Yes). |
vascular_invasion |
String. Extent of vascular invasion: "none", "segmental", "renal vein", or "caval". |
nodal_involvement |
Numeric (0 or 1). Presence of pathological lymph node metastasis. (1 = Yes). |
sarcomatoid |
Numeric (0 or 1). Presence of sarcomatoid features. (1 = Yes). |
Value
A list containing:
Total_Points |
The calculated prognostic score based on the nomogram weights. |
DFS_Risk_Group |
Risk group for Disease-Free Survival (Low, Intermediate, High). |
OS_Risk_Group |
Risk group for Overall Survival (Low, Intermediate, High). |
References
Correa AF, et al. Predicting Disease Recurrence, Early Progression, and Overall Survival Following Surgical Resection for High-risk Localized and Locally Advanced Renal Cell Carcinoma. Eur Urol. 2021;80(2):20-31.
Examples
# Example 1: High Risk
# Clear Cell, Grade 4, 8cm, Necrosis, Renal Vein Inv, N1
# Points: 35 (Hist) + 78 (Gr4) + 32 (Size) + 23 (Necr) + 30 (Vasc) + 65 (Node) = 263 -> High
assure_rcc_prognosis("clear cell", 4, 8.0, 1, "renal vein", 1, 0)
# Example 2: Low Risk
# Chromophobe, Grade 2, 4cm, No Necrosis, No Vasc, N0
# Points: 0 (Hist) + 13 (Gr2) + 16 (Size) = 29 -> Low
assure_rcc_prognosis("chromophobe", 2, 4.0, 0, "none", 0, 0)
De Ritis Ratio (Ast/Alt Ratio)
Description
The De Ritis Ratio has been used clinically and in research for almost 50 years and is simply the ratio of aspartate transferase to alanine transferase. Validated in many cohorts, interpretations vary, and as such, I simply define a ratio of above 0.8 as indicative of liver injury, commonly agreed upon in the literature.
Usage
ast_alt_ratio_interpret(ast, alt)
Arguments
ast |
Numeric value of aspartate transferase (U/L). |
alt |
Numeric value of alanine transferase (U/L). |
Value
A numeric value/vector with whether by De Ritis ratio, there is liver injury.
References
Botros M, Sikaris KA. The de ritis ratio: the test of time. Clin Biochem Rev. 2013 Nov;34(3):117-30. PMID: 24353357; PMCID: PMC3866949.
Examples
# The function is defined as
ast_alt_ratio_interpret(30, 25)
Asthma Predictive Index (API)
Description
Calculates the Stringent Asthma Predictive Index (API) to predict the likelihood of developing active asthma at school age in children younger than 3 years who present with frequent wheezing. This tool is based on the original Castro-Rodriguez criteria derived from the Tucson Children's Respiratory Study.
Usage
asthma_predictive_index(wheezing_freq_ge_4, parent_asthma, eczema,
allergic_rhinitis, wheezing_apart_colds,
eosinophilia_ge_4)
Arguments
wheezing_freq_ge_4 |
Numeric (0 or 1). Does the child have a history of frequent wheezing (>= 4 episodes/year) with at least one physician-confirmed episode? (Entry Criterion). |
parent_asthma |
Numeric (0 or 1). Parental history of asthma. (Major Criterion). |
eczema |
Numeric (0 or 1). Physician-diagnosed atopic dermatitis (eczema). (Major Criterion). |
allergic_rhinitis |
Numeric (0 or 1). Physician-diagnosed allergic rhinitis. (Minor Criterion). |
wheezing_apart_colds |
Numeric (0 or 1). Wheezing apart from colds. (Minor Criterion). |
eosinophilia_ge_4 |
Numeric (0 or 1). Peripheral eosinophilia >= 4%. (Minor Criterion). |
Value
A list containing:
Result |
"Positive Stringent API" or "Negative Stringent API". |
Interpretation |
Prognostic information regarding the risk of asthma at ages 6-13. |
Stats |
Predictive values (PPV, Specificity) derived from the validation studies. |
References
Castro-Rodriguez JA, Holberg CJ, Wright AL, Martinez FD. A clinical index to define risk of asthma in young children with recurrent wheeze. Am J Respir Crit Care Med. 2000;162(4 Pt 1):1403-1406. doi:10.1164/ajrccm.162.4.9912111
Examples
# Example 1: Positive API
# Freq wheezing, Parent Asthma (Major), No others
# Result: Positive (1 Major met)
asthma_predictive_index(1, 1, 0, 0, 0, 0)
# Example 2: Positive API via Minor Criteria
# Freq wheezing, No Major, Allergic Rhinitis + Eosinophilia (2 Minor)
asthma_predictive_index(1, 0, 0, 1, 0, 1)
# Example 3: Negative API
# Freq wheezing, only Eosinophilia (1 Minor)
asthma_predictive_index(1, 0, 0, 0, 0, 1)
ASTRAL Score for Ischemic Stroke
Description
Calculates the ASTRAL (Acute Stroke Registry and Analysis of Lausanne) Score to predict the probability of an unfavorable functional outcome (modified Rankin Scale score > 2) at 3 months following an acute ischemic stroke.
Usage
astral_stroke_score(age, nihss, time_gt_3h, visual_field_defect, glucose,
loc_reduced, glucose_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. (Score adds 1 point for every 5 years). |
nihss |
Numeric. Admission NIH Stroke Scale score (0-42). (Score adds 1 point for every 1 NIHSS point). |
time_gt_3h |
Numeric (0 or 1). Time from symptom onset to admission > 3 hours. (1 = Yes, +2 points). |
visual_field_defect |
Numeric (0 or 1). Presence of any visual field defect (from NIHSS item 3). (1 = Yes, +2 points). |
glucose |
Numeric. Admission blood glucose level. (> 131 mg/dL or > 7.3 mmol/L adds +1 point). |
loc_reduced |
Numeric (0 or 1). Reduced level of consciousness (NIHSS item 1a > 0). (1 = Yes, +2 points). |
glucose_units |
String. Units for glucose input. Options: "mg/dL" (default) or "mmol/L". |
Value
A list containing:
ASTRAL_Score |
The calculated integer score. |
Unfavorable_Outcome_Probability_3mo |
Estimated percentage probability of death or dependency (mRS 3-6) at 3 months. |
References
Ntaios G, Faouzi M, Ferrari J, et al. An integer-based score to predict functional outcome in acute ischemic stroke: the ASTRAL score. Neurology. 2012;78(24):1916-1922. doi:10.1212/WNL.0b013e318259e221
Examples
# Example 1: High Risk
# 80yo (16pts), NIHSS 20, Time >3h (2), Visual Defect (2), Glucose 150 (1), Reduced LOC (2)
# Score = 16 + 20 + 2 + 2 + 1 + 2 = 43
astral_stroke_score(80, 20, 1, 1, 150, 1)
# Example 2: Moderate Risk
# 65yo (13pts), NIHSS 8, Time <3h (0), No Visual (0), Glucose 100 (0), Alert LOC (0)
# Score = 13 + 8 = 21
astral_stroke_score(65, 8, 0, 0, 100, 0)
Mayo Clinic Risk Stratification for Smoldering Multiple Myeloma (20-2-20 Model)
Description
Calculates the risk stratification for patients with Smoldering Multiple Myeloma (SMM) using the "20-2-20" criteria developed by the Mayo Clinic. This model predicts the risk of progression to active Multiple Myeloma (MM) based on three risk factors: Bone Marrow Plasma Cells (BMPC) > 20%, Serum M-protein > 2 g/dL, and Serum Free Light Chain (FLC) ratio > 20.
Usage
asymptomatic_myeloma_prognosis(bmpc_percent, m_protein_g_dl, flc_ratio)
Arguments
bmpc_percent |
Numeric. Bone marrow plasma cells in percentage. (Threshold: > 20%). |
m_protein_g_dl |
Numeric. Serum M-protein level in g/dL. (Threshold: > 2 g/dL). |
flc_ratio |
Numeric. Serum Free Light Chain ratio (involved : uninvolved). (Threshold: > 20). |
Value
A list containing:
Total_Risk_Factors |
The count of risk factors present (0, 1, 2, or 3). |
Risk_Group |
Classification (Low, Intermediate, or High Risk). |
Median_Time_to_Progression |
Estimated median time to progression to active myeloma. |
Progression_Risk_2yr |
Estimated probability of progression within 2 years. |
References
Lakshman A, Rajkumar SV, Buadi FK, et al. Risk stratification of smoldering multiple myeloma incorporating revised IMWG diagnostic criteria. Blood Cancer J. 2018;8(6):59. doi:10.1038/s41408-018-0077-4
Examples
# Example 1: High Risk (2 factors)
# BMPC 30%, M-protein 1.5, FLC Ratio 25
asymptomatic_myeloma_prognosis(30, 1.5, 25)
# Example 2: Low Risk (0 factors)
# BMPC 10%, M-protein 1.0, FLC Ratio 8
asymptomatic_myeloma_prognosis(10, 1.0, 8)
ATLAS Score for Clostridium Difficile Infection
Description
Calculates the ATLAS Score to predict cure rates and 30-day mortality in patients with Clostridium difficile infection (CDI). The score evaluates Age, Treatment with systemic antibiotics, Leukocyte count, Albumin, and Serum creatinine.
Usage
atlas_cdi_score(age, systemic_abx, wbc_count, albumin, creatinine,
albumin_units = "g/dL", creatinine_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. (<60: 0 pts; 60-79: 1 pt; >=80: 2 pts). |
systemic_abx |
Numeric (0 or 1). Concomitant treatment with systemic antibiotics during CDI therapy. (1 = Yes: 2 pts; 0 = No: 0 pts). |
wbc_count |
Numeric. White Blood Cell count. Can be entered as cells/uL (e.g., 16000) or k/uL (e.g., 16.0). (<16k: 0 pts; 16k-25k: 1 pt; >25k: 2 pts). |
albumin |
Numeric. Serum albumin level. (>3.5 g/dL: 0 pts; 2.6-3.5 g/dL: 1 pt; <=2.5 g/dL: 2 pts). |
creatinine |
Numeric. Serum creatinine level. (<=1.3 mg/dL: 0 pts; 1.4-2.0 mg/dL: 1 pt; >2.0 mg/dL: 2 pts). |
albumin_units |
String. Units for albumin. "g/dL" (default) or "g/L". |
creatinine_units |
String. Units for creatinine. "mg/dL" (default) or "umol/L". |
Value
A list containing:
ATLAS_Score |
The calculated score (Range 0-10). |
Predicted_Cure_Rate |
Estimated probability of cure. |
Predicted_Mortality_30_Day |
Estimated 30-day mortality risk. |
References
Miller MA, et al. Derivation and validation of a simple clinical bedside score (ATLAS) for Clostridium difficile infection which predicts response to therapy. BMC Infect Dis. 2013;13:148.
Examples
# Example 1: Low Risk
# 45yo, No abx, WBC 10k, Alb 4.0, Cr 0.9
atlas_cdi_score(45, 0, 10000, 4.0, 0.9)
# Example 2: High Risk
# 85yo (+2), On Abx (+2), WBC 26k (+2), Alb 2.0 (+2), Cr 2.5 (+2)
# Score = 10
atlas_cdi_score(85, 1, 26000, 2.0, 2.5)
ATRIA Bleeding Risk Score
Description
Calculates the ATRIA (Anticoagulation and Risk Factors in Atrial Fibrillation) Bleeding Risk Score. This tool stratifies the risk of major hemorrhage in patients with atrial fibrillation who are taking warfarin. It outperforms the HAS-BLED score in predicting major bleeding events.
Usage
atria_bleeding_risk(age, sex, hemoglobin_g_dl, egfr_ml_min, prior_bleeding, hypertension)
Arguments
age |
Numeric. Patient age in years. (>= 75 years adds +2 points). |
sex |
String. Patient sex ("Male" or "Female"). Used to define anemia thresholds. |
hemoglobin_g_dl |
Numeric. Hemoglobin level in g/dL. Anemia (<13 g/dL in men, <12 g/dL in women) adds +3 points. |
egfr_ml_min |
Numeric. Estimated Glomerular Filtration Rate (eGFR) in mL/min/1.73m^2. Severe renal disease (<30 mL/min) adds +3 points. |
prior_bleeding |
Numeric (0 or 1). History of prior hemorrhage diagnosis. (1 = Yes, +1 point). |
hypertension |
Numeric (0 or 1). History of hypertension. (1 = Yes, +1 point). |
Value
A list containing:
ATRIA_Score |
The calculated risk score (Range 0-10). |
Risk_Category |
Classification (Low: 0-3, Intermediate: 4, High: >4). |
Annual_Major_Bleeding_Risk |
Estimated annual rate of major hemorrhage. |
References
Fang MC, Go AS, Chang Y, et al. A new risk scheme to predict warfarin-associated hemorrhage: The ATRIA (Anticoagulation and Risk Factors in Atrial Fibrillation) Study. J Am Coll Cardiol. 2011;58(4):395-401. doi:10.1016/j.jacc.2011.03.031
Examples
# Example 1: High Risk
# 80yo Male (+2), Hgb 11 (+3), eGFR 25 (+3), No Bleed, HTN (+1)
# Score = 9
atria_bleeding_risk(80, "male", 11, 25, 0, 1)
# Example 2: Low Risk
# 65yo Female (0), Hgb 13 (0), eGFR 60 (0), No Bleed, No HTN
# Score = 0
atria_bleeding_risk(65, "female", 13, 60, 0, 0)
ATRIA Stroke Risk Score
Description
Calculates the ATRIA (Anticoagulation and Risk Factors in Atrial Fibrillation) Stroke Risk Score. This tool estimates the risk of ischemic stroke in patients with atrial fibrillation. It was developed to improve upon the CHADS2 score by incorporating differential weighting for age, prior stroke, and including renal dysfunction variables.
Usage
atria_stroke_risk(age, prior_stroke, female_sex, diabetes, chf,
hypertension, proteinuria, egfr_lt_45_or_esrd)
Arguments
age |
Numeric. Patient age in years. <65: 0 points. 65-74: 3 points. 75-84: 5 points. >=85: 6 points. |
prior_stroke |
Numeric (0 or 1). History of prior stroke. (1 = Yes, +4 points). |
female_sex |
Numeric (0 or 1). Patient is female. (1 = Yes, +1 point). |
diabetes |
Numeric (0 or 1). History of diabetes mellitus. (1 = Yes, +1 point). |
chf |
Numeric (0 or 1). History of Congestive Heart Failure. (1 = Yes, +1 point). |
hypertension |
Numeric (0 or 1). History of hypertension. (1 = Yes, +1 point). |
proteinuria |
Numeric (0 or 1). Presence of proteinuria. (1 = Yes, +1 point). |
egfr_lt_45_or_esrd |
Numeric (0 or 1). eGFR < 45 mL/min/1.73m^2 or End-Stage Renal Disease. (1 = Yes, +1 point). |
Value
A list containing:
ATRIA_Score |
The calculated risk score (Range 0-15). |
Risk_Category |
Classification (Low 0-5, Moderate 6, High 7-15). |
Annual_Stroke_Risk |
Estimated annual stroke rate. |
References
Singer DE, Chang Y, Borowsky LH, et al. A new risk scheme to predict ischemic stroke and other thromboembolism in atrial fibrillation: the ATRIA (Anticoagulation and Risk Factors in Atrial Fibrillation) Study. J Am Heart Assoc. 2013;2(3):e000250. doi:10.1161/JAHA.113.000250
Examples
# Example 1: High Risk
# 85yo (+6), Female (+1), Prior Stroke (+4)
# Score = 11
atria_stroke_risk(85, 1, 1, 0, 0, 0, 0, 0)
# Example 2: Low Risk
# 70yo (+3), HTN (+1), No other factors
# Score = 4
atria_stroke_risk(70, 0, 0, 0, 0, 1, 0, 0)
Atropine Dosing for Cholinesterase Inhibitor Toxicity
Description
Calculates the recommended atropine dosing for patients with organophosphate or carbamate toxicity (cholinesterase inhibitor poisoning). The protocol utilizes a "doubling dose" strategy: if bronchial secretions remain copious after the initial dose, the subsequent dose is doubled every 5-10 minutes until secretions are dried (atropinization). Once controlled, a maintenance infusion is calculated.
Usage
atropine_toxicity_dosing(last_dose_mg, secretions_controlled,
total_cumulative_dose_mg = NULL)
Arguments
last_dose_mg |
Numeric. The amount of atropine (in mg) administered in the most recent bolus. |
secretions_controlled |
Numeric (0 or 1). Assessment of therapeutic endpoint (clear breath sounds, dry axillae, no bronchorrhea). (1 = Yes, 0 = No). |
total_cumulative_dose_mg |
Numeric (Optional). The total sum of all bolus doses administered to achieve control. Required to calculate the maintenance infusion rate (typically 10-20% of the total loading dose per hour). |
Value
A list containing:
Status |
Current clinical status (Controlled vs. Uncontrolled). |
Recommendation |
Clinical action plan (Double dose or Start infusion). |
Next_Bolus_Dose_mg |
The recommended quantity for the next IV push if uncontrolled. |
Maintenance_Infusion_Rate |
The recommended hourly infusion rate if controlled. |
References
Eddleston M, Buckley NA, Eyer P, Dawson AH. Management of acute organophosphorus pesticide poisoning. Lancet. 2008;371(9612):597-607. doi:10.1016/S0140-6736(07)61202-1
Examples
# Example 1: Uncontrolled after 2mg
# Secretions still present (0)
atropine_toxicity_dosing(2, 0)
# Example 2: Uncontrolled after 4mg
# Secretions still present (0) -> Recommends 8mg
atropine_toxicity_dosing(4, 0)
# Example 3: Controlled
# Secretions dry (1). Total dose given was 20mg.
# Recommends infusion at 2-4 mg/hr
atropine_toxicity_dosing(8, 1, total_cumulative_dose_mg = 20)
American Urological Association Symptom Index (AUA-SI)
Description
Calculates the AUA Symptom Index (also known as the International Prostate Symptom Score, IPSS) for Benign Prostatic Hyperplasia (BPH). The index consists of 7 questions regarding urinary symptoms, each scored from 0 to 5. An optional 8th question assesses Quality of Life (QoL) regarding urinary symptoms.
Usage
aua_symptom_index(incomplete_emptying, frequency, intermittency, urgency,
weak_stream, straining, nocturia, quality_of_life = NULL)
Arguments
incomplete_emptying |
Numeric (0-5). Sensation of not emptying bladder completely after finishing. |
frequency |
Numeric (0-5). Frequency of urination (less than 2 hours after finishing). |
intermittency |
Numeric (0-5). Stopping and starting several times when urinating. |
urgency |
Numeric (0-5). Difficulty postponing urination. |
weak_stream |
Numeric (0-5). Weak urinary stream. |
straining |
Numeric (0-5). Need to push or strain to begin urination. |
nocturia |
Numeric (0-5). Number of times getting up to urinate from the time going to bed until getting up in the morning. |
quality_of_life |
Numeric (0-6) (Optional). "If you were to spend the rest of your life with your urinary condition just the way it is now, how would you feel about that?" 0=Delighted, 1=Pleased, 2=Mostly Satisfied, 3=Mixed, 4=Mostly Dissatisfied, 5=Unhappy, 6=Terrible. |
Details
Scoring Key (Questions 1-6): 0 = Not at all 1 = Less than 1 time in 5 2 = Less than half the time 3 = About half the time 4 = More than half the time 5 = Almost always
Value
A list containing:
AUA_Symptom_Score |
Sum of the 7 symptom scores (Range 0-35). |
Severity_Category |
"Mild" (0-7), "Moderate" (8-19), or "Severe" (20-35). |
Quality_of_Life_Description |
Text description corresponding to the QoL score. |
References
Barry MJ, Fowler FJ Jr, O'Leary MP, et al. The American Urological Association symptom index for benign prostatic hyperplasia. The Measurement Committee of the American Urological Association. J Urol. 1992;148(5):1549-1557. doi:10.1016/s0022-5347(17)36966-5
Examples
# Example 1: Moderate Symptoms
# Scores: 2, 2, 3, 1, 3, 1, 2 = 14
aua_symptom_index(2, 2, 3, 1, 3, 1, 2, quality_of_life = 3)
# Example 2: Mild Symptoms
# All 1s = 7
aua_symptom_index(1, 1, 1, 1, 1, 1, 1)
American University of Beirut (AUB) HAS2 Cardiovascular Risk Index
Description
Calculates the AUB-HAS2 score to stratify cardiovascular risk. This simple additive risk index was derived and validated to predict major adverse cardiovascular events (death, myocardial infarction, or coronary revascularization) using four easily obtainable clinical variables: Hypertension, Age, Smoking, and Hyperlipidemia (HAS2).
Usage
aub_has2_cardiovascular_risk(hypertension, age, smoking, hyperlipidemia)
Arguments
hypertension |
Numeric (0 or 1). History of Hypertension. (1 = Yes, +1 point). |
age |
Numeric. Patient age in years. (>= 60 years adds +1 point). |
smoking |
Numeric (0 or 1). Current or recent smoker (< 1 year). (1 = Yes, +1 point). |
hyperlipidemia |
Numeric (0 or 1). History of Hyperlipidemia or Dyslipidemia. (1 = Yes, +2 points). |
Value
A list containing:
Total_Score |
The calculated AUB-HAS2 score (Range 0-5). |
Risk_Category |
Risk classification (Low: 0-1, Intermediate: 2, High: >=3). |
References
Dakik HA, Chehab O, Eldanawi H, et al. The AUB-HAS2 Cardiovascular Risk Index: A Simple Outcome Score for Clinical Practice. PLoS One. 2016;11(1):e0146534. doi:10.1371/journal.pone.0146534
Examples
# Example 1: High Risk
# Hypertension (+1), Age 65 (+1), Hyperlipidemia (+2) -> Score 4
aub_has2_cardiovascular_risk(1, 65, 0, 1)
# Example 2: Low Risk
# Smoking only (+1), Age 40, No HTN/Lipids
# Score = 1
aub_has2_cardiovascular_risk(0, 40, 1, 0)
AUDIT-C Alcohol Use Screen
Description
Calculates the AUDIT-C (Alcohol Use Disorders Identification Test - Consumption) score. This is a 3-item screening tool derived from the full AUDIT to identify patients with hazardous alcohol consumption or active alcohol use disorders.
Usage
audit_c_alcohol_screen(sex, frequency_score, amount_score, binge_score)
Arguments
sex |
String. Patient sex ("Male" or "Female"). Cutoffs differ by sex (Male >= 4, Female >= 3). |
frequency_score |
Numeric (0-4). "How often do you have a drink containing alcohol?" 0: Never. 1: Monthly or less. 2: 2-4 times a month. 3: 2-3 times a week. 4: 4 or more times a week. |
amount_score |
Numeric (0-4). "How many standard drinks containing alcohol do you have on a typical day?" 0: 1 or 2. 1: 3 or 4. 2: 5 or 6. 3: 7 to 9. 4: 10 or more. |
binge_score |
Numeric (0-4). "How often do you have six or more drinks on one occasion?" 0: Never. 1: Less than monthly. 2: Monthly. 3: Weekly. 4: Daily or almost daily. |
Value
A list containing:
AUDIT_C_Score |
The calculated total score (Range 0-12). |
Screen_Result |
"Positive Screen" or "Negative Screen". |
Interpretation |
Clinical guidance based on the score. |
References
Bush K, Kivlahan DR, McDonell MB, Fihn SD, Bradley KA. The AUDIT alcohol consumption questions (AUDIT-C): an effective brief screening test for problem drinking. Ambulatory Care Quality Improvement Project (ACQUIP). Alcohol Use Disorders Identification Test. Arch Intern Med. 1998;158(16):1789-1795. doi:10.1001/archinte.158.16.1789
Examples
# Example 1: Positive Screen (Male)
# Frequent drinking (3), Moderate amount (1), Occasional binge (2)
# Score = 6
audit_c_alcohol_screen("male", 3, 1, 2)
# Example 2: Negative Screen (Female)
# Monthly drinking (1), Low amount (0), No binge (0)
# Score = 1
audit_c_alcohol_screen("female", 1, 0, 0)
Australian Type 2 Diabetes Risk Assessment Tool (AUSDRISK)
Description
Calculates the AUSDRISK score to estimate the 5-year risk of developing Type 2 Diabetes. This tool is designed for use in the general Australian adult population. It evaluates demographic, lifestyle, and anthropometric risk factors.
Usage
ausdrisk_score(age, sex, ethnicity_high_risk, family_history,
high_glucose_history, bp_meds, smoker, fruit_veg_daily,
physical_activity_sufficient, waist_cm)
Arguments
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). (Male adds +3 points). |
ethnicity_high_risk |
Numeric (0 or 1). Is the patient of Aboriginal, Torres Strait Islander, Pacific Islander, Southern European, or Asian background? (1 = Yes, +2 points). |
family_history |
Numeric (0 or 1). History of diabetes in a parent, brother, or sister. (1 = Yes, +3 points). |
high_glucose_history |
Numeric (0 or 1). History of high blood glucose levels (e.g., during pregnancy or borderline check). (1 = Yes, +6 points). |
bp_meds |
Numeric (0 or 1). Current use of blood pressure medication. (1 = Yes, +2 points). |
smoker |
Numeric (0 or 1). Current smoker. (1 = Yes, +2 points). |
fruit_veg_daily |
Numeric (0 or 1). Consumes fruit and vegetables every day. (1 = Yes, 0 points; 0 = No, +1 point). |
physical_activity_sufficient |
Numeric (0 or 1). Engages in at least 2.5 hours of physical activity per week. (1 = Yes, 0 points; 0 = No, +2 points). |
waist_cm |
Numeric. Waist circumference in centimeters. Male: 90-100 cm (+4), >100 cm (+7). Female: 80-90 cm (+4), >90 cm (+7). |
Value
A list containing:
AUSDRISK_Score |
The calculated total risk score. |
Risk_Level |
Classification (Low: <=5, Intermediate: 6-11, High: >=12). |
Probability_5_Year |
Estimated probability description. |
References
Department of Health and Aged Care. The Australian Type 2 Diabetes Risk Assessment Tool (AUSDRISK). Australian Government. 2008.
Examples
# Example 1: High Risk
# 50yo Male (+7), Asian (+2), FamHx (+3), No Activity (+2), Waist 95 (+4)
# Score = 4 (Age) + 3 (Sex) + 2 (Eth) + 3 (Fam) + 2 (Act) + 4 (Waist) = 18
ausdrisk_score(50, "male", 1, 1, 0, 0, 0, 1, 0, 95)
# Example 2: Low Risk
# 30yo Female, No risk factors
# Score = 0
ausdrisk_score(30, "female", 0, 0, 0, 0, 0, 1, 1, 70)
AWOL Score for Delirium
Description
Calculates the AWOL score to predict the risk of developing delirium during hospitalization. The score assesses four risk factors: Age, ability to spell "World" backwards, Orientation, and iLlnes severity.
Usage
awol_delirium_risk(age, spell_world_failed, orientation_failed,
illness_severity_moderate_severe)
Arguments
age |
Numeric. Patient age in years. (>= 80 years adds +1 point). |
spell_world_failed |
Numeric (0 or 1). Failure to spell "World" backwards correctly. (1 = Yes/Failed, +1 point). |
orientation_failed |
Numeric (0 or 1). Failure to correctly name the city, state, county, hospital name, or floor. (1 = Yes/Failed, +1 point). |
illness_severity_moderate_severe |
Numeric (0 or 1). Nurse-rated illness severity is "Moderate" or "Severe" (as opposed to Mild). (1 = Yes, +1 point). |
Value
A list containing:
AWOL_Score |
The total calculated score (Range 0-4). |
Risk_Category |
General classification (Low Risk < 2, High Risk >= 2). |
Est_Delirium_Risk |
Estimated percentage probability of developing delirium. |
References
Douglas VC, Hessler CS, Dhaliwal G, et al. The AWOL tool: derivation and validation of a delirium prediction rule. J Hosp Med. 2013;8(9):493-499. doi:10.1002/jhm.2062
Examples
# Example 1: High Risk
# 82yo (+1), Failed spelling (+1), Oriented (0), Moderate Severity (+1)
# Score = 3 (~37% risk)
awol_delirium_risk(82, 1, 0, 1)
# Example 2: Low Risk
# 65yo (0), Spelled correctly (0), Oriented (0), Mild Severity (0)
# Score = 0 (~2% risk)
awol_delirium_risk(65, 0, 0, 0)
Bacterial Meningitis Score for Children
Description
Calculates the Bacterial Meningitis Score to stratify the risk of bacterial meningitis in children (aged 29 days to 19 years) presenting with CSF pleocytosis (>= 10 WBCs/uL). A score of 0 identifies patients at very low risk who may be candidates for outpatient management.
Usage
bacterial_meningitis_score(gram_stain_positive, csf_protein_mg_dl,
peripheral_anc, seizure_history, csf_neutrophils)
Arguments
gram_stain_positive |
Numeric (0 or 1). Is the CSF Gram stain positive for bacteria? (1 = Yes, +2 points). |
csf_protein_mg_dl |
Numeric. CSF protein level in mg/dL. (>= 80 mg/dL adds +1 point). |
peripheral_anc |
Numeric. Peripheral blood Absolute Neutrophil Count (cells/mm3). (>= 10,000 cells/mm3 adds +1 point). |
seizure_history |
Numeric (0 or 1). Seizure at or prior to presentation? (1 = Yes, +1 point). |
csf_neutrophils |
Numeric. CSF Absolute Neutrophil Count (cells/mm3). (>= 1,000 cells/mm3 adds +1 point). |
Value
A list containing:
BMS_Score |
The calculated Bacterial Meningitis Score (Range 0-6). |
Risk_Category |
"Very Low Risk" (Score 0) or "Not Low Risk" (Score >= 1). |
Interpretation |
Clinical guidance based on the score. |
References
Nigrovic LE, Kuppermann N, Malley R. Development and validation of a multivariable predictive model to distinguish bacterial from aseptic meningitis in children in the post-Haemophilus influenzae era. Pediatrics. 2002;110(4):712-719. doi:10.1542/peds.110.4.712
Examples
# Example 1: High Risk
# Positive Gram stain (+2), Protein 90 (+1), ANC 12000 (+1)
# Score = 4
bacterial_meningitis_score(1, 90, 12000, 0, 500)
# Example 2: Very Low Risk
# Negative Gram stain, Protein 40, ANC 5000, No seizure, CSF Neuts 100
# Score = 0
bacterial_meningitis_score(0, 40, 5000, 0, 100)
BALL Score for Relapsed/Refractory CLL
Description
Calculates the BALL (Beta-2 microglobulin, Anemia, LDH, Last therapy) score to prognosticate Overall Survival in patients with relapsed or refractory Chronic Lymphocytic Leukemia (CLL). This score uses four readily available clinical variables to stratify patients into Low, Intermediate, or High risk categories.
Usage
ball_score_cll(beta2_microglobulin_mg_l, hemoglobin_g_dl, sex, ldh_elevated,
last_therapy_pfs_lt_24mo)
Arguments
beta2_microglobulin_mg_l |
Numeric. Serum Beta-2 microglobulin level in mg/L. (> 3.5 mg/L adds +1 point). |
hemoglobin_g_dl |
Numeric. Hemoglobin level in g/dL. Anemia (Male < 12 g/dL; Female < 11 g/dL) adds +1 point. |
sex |
String. Patient sex ("Male" or "Female"). Used to determine the anemia threshold. |
ldh_elevated |
Numeric (0 or 1). Is Lactate Dehydrogenase (LDH) greater than the Upper Limit of Normal? (1 = Yes, +1 point). |
last_therapy_pfs_lt_24mo |
Numeric (0 or 1). Was the duration of response (progression-free survival) to the last prior therapy < 24 months? (1 = Yes, +1 point). |
Value
A list containing:
BALL_Score |
The calculated score (Range 0-4). |
Risk_Group |
Classification (Low 0-1, Intermediate 2-3, High 4). |
Est_2Yr_Overall_Survival |
Estimated 2-year Overall Survival percentage based on the validation cohort. |
References
Grosicki S, et al. The BALL score: a new prognostic model for relapsed/refractory chronic lymphocytic leukemia patients. Leuk Lymphoma. 2020.
Examples
# Example 1: High Risk
# B2M 5.0 (+1), Hb 10 (Male, +1), High LDH (+1), Short prior remission (+1)
# Score = 4
ball_score_cll(5.0, 10.0, "male", 1, 1)
# Example 2: Low Risk
# B2M 2.0 (0), Hb 13 (Female, 0), Normal LDH (0), Long prior remission (0)
# Score = 0
ball_score_cll(2.0, 13.0, "female", 0, 0)
BAP-65 Score for Acute Exacerbation of COPD
Description
Calculates the BAP-65 score to stratify risk in patients presenting with an acute exacerbation of Chronic Obstructive Pulmonary Disease (COPD). The score correlates with in-hospital mortality and need for mechanical ventilation.
Usage
bap65_copd(bun, altered_mental_status, pulse, age)
Arguments
bun |
Numeric. Blood Urea Nitrogen in mg/dL. (>= 25 mg/dL adds +1 point). |
altered_mental_status |
Numeric (0 or 1). Presence of altered mental status (GCS <= 14 or disorientation). (1 = Yes, +1 point). |
pulse |
Numeric. Heart rate in bpm. (>= 109 bpm adds +1 point). |
age |
Numeric. Patient age in years. (> 65 years adds +1 point). |
Value
A list containing:
BAP65_Score |
The calculated score (Range 0-4). |
Risk_Class |
Classification (Class I to IV). |
In_Hospital_Mortality |
Estimated in-hospital mortality risk. |
Recommendation |
Clinical guidance regarding disposition (discharge, ward, or ICU). |
References
Shorr AF, Sun X, Johannes RS, Yaitanes A, Tabak YP. Validation of a novel risk score for severity of illness in acute exacerbations of COPD. Chest. 2011;140(5):1177-1183. doi:10.1378/chest.10-2851
Examples
# Example 1: High Risk (Class IV)
# BUN 30 (+1), Alert (0), Pulse 115 (+1), Age 70 (+1)
# Score = 3
bap65_copd(30, 0, 115, 70)
# Example 2: Low Risk (Class I)
# BUN 15 (0), Alert (0), Pulse 80 (0), Age 60 (0)
# Score = 0
bap65_copd(15, 0, 80, 60)
BARD Score for assessing Fibrosis in NAFLD
Description
By using a patient's bmi, lab values of aspartate transferae, alanine transferase, and whether they have type 2 diabetes, calculate the patient's risk for fibrosis, especially if they have diagnosed or suspected NAFLD. BARD score from 0-1 is low risk of fibrosis and a score from 2-4 is high risk of fibrosis. Created by Harrison et al. 2008. Validated by Ruffillo et al. (2011) and Raszeja-wyszomirska et al. (2010).
Usage
bard_score(bmi, ast, alt, diabetes)
Arguments
bmi |
Numeric value of bmi (kg/m^2). |
ast |
Numeric value of aspartate transferase (U/L). |
alt |
Numeric value of alanine transferase (U/L). |
diabetes |
Numeric value of type 2 diabetes mellitus status yes = 1, no = 0. |
Value
A numeric value/vector with predicted BARD score.
References
Harrison SA, Oliver D, Arnold HL, Gogia S, Neuschwander-tetri BA. Development and validation of a simple NAFLD clinical scoring system for identifying patients without advanced disease. Gut. 2008;57(10):1441-7. Raszeja-wyszomirska J, Szymanik B, Ławniczak M, et al. Validation of the BARD scoring system in Polish patients with nonalcoholic fatty liver disease (NAFLD). BMC Gastroenterol. 2010;10:67. Ruffillo G, Fassio E, Alvarez E, et al. Comparison of NAFLD fibrosis score and BARD score in predicting fibrosis in nonalcoholic fatty liver disease. J Hepatol. 2011;54(1):160-3. Cichoż-lach H, Celiński K, Prozorow-król B, Swatek J, Słomka M, Lach T. The BARD score and the NAFLD fibrosis score in the assessment of advanced liver fibrosis in nonalcoholic fatty liver disease. Med Sci Monit. 2012;18(12):CR735-40.
Examples
# The function is defined as
bard_score(25, 40, 32, 1)
BARD Score for assessing Fibrosis in NAFLD Interpretation
Description
By using a patient's bmi, lab values of aspartate transferae, alanine transferase, and whether they have type 2 diabetes, calculate the patient's risk for fibrosis, especially if they have diagnosed or suspected NAFLD. Created by Harrison et al. 2008. Validated by Ruffillo et al. (2011) and Raszeja-wyszomirska et al. (2010).
Usage
bard_score_interpret(bmi, ast, alt, diabetes)
Arguments
bmi |
Numeric value of bmi (kg/m^2). |
ast |
Numeric value of aspartate transferase (U/L). |
alt |
Numeric value of alanine transferase (U/L). |
diabetes |
Numeric value of type 2 diabetes mellitus status yes = 1, no = 0. |
Value
A string with interpreted BARD score as "high" or "low" fibrosis.
References
Harrison SA, Oliver D, Arnold HL, Gogia S, Neuschwander-tetri BA. Development and validation of a simple NAFLD clinical scoring system for identifying patients without advanced disease. Gut. 2008;57(10):1441-7. Raszeja-wyszomirska J, Szymanik B, Ławniczak M, et al. Validation of the BARD scoring system in Polish patients with nonalcoholic fatty liver disease (NAFLD). BMC Gastroenterol. 2010;10:67. Ruffillo G, Fassio E, Alvarez E, et al. Comparison of NAFLD fibrosis score and BARD score in predicting fibrosis in nonalcoholic fatty liver disease. J Hepatol. 2011;54(1):160-3. Cichoż-lach H, Celiński K, Prozorow-król B, Swatek J, Słomka M, Lach T. The BARD score and the NAFLD fibrosis score in the assessment of advanced liver fibrosis in nonalcoholic fatty liver disease. Med Sci Monit. 2012;18(12):CR735-40.
Examples
# The function is defined as
bard_score_interpret(25, 40, 32, 1)
Barnes-Jewish Hospital Stroke Dysphagia Screen
Description
Implements the Barnes-Jewish Hospital Stroke Dysphagia Screen, a validated bedside tool to assess swallowing function in acute stroke patients. The screen consists of two stages: an initial assessment of consciousness and oral motor function, followed by a 3-oz water swallow test if the first stage is passed.
Usage
barnes_jewish_dysphagia_screen(gcs, facial_asymmetry, tongue_asymmetry,
palatal_asymmetry, water_swallow_signs = NULL)
Arguments
gcs |
Numeric. Glasgow Coma Scale score (3-15). A score < 13 results in immediate failure. |
facial_asymmetry |
Numeric (0 or 1). Presence of facial asymmetry or weakness. (1 = Yes/Fail). |
tongue_asymmetry |
Numeric (0 or 1). Presence of tongue asymmetry or weakness. (1 = Yes/Fail). |
palatal_asymmetry |
Numeric (0 or 1). Presence of palatal asymmetry or weakness. (1 = Yes/Fail). |
water_swallow_signs |
Numeric (0 or 1) (Optional). Signs of aspiration (coughing, choking, wet voice) during or within 1 minute of the 3-oz water swallow test. (1 = Yes/Fail, 0 = No/Pass). Required only if the patient passes the initial anatomical assessment. |
Value
A list containing:
Screen_Result |
"Passed", "Failed Bedside Assessment", or "Failed Water Swallow Test". |
Action_Plan |
Clinical recommendation regarding diet status (NPO vs. oral intake) and Speech Therapy consult. |
Fail_Criteria |
List of specific items that caused the screen failure. |
References
Edmiaston J, Connor LT, Loehr L, Nassief A. Validation of a dysphagia screening tool in acute stroke patients. Am J Crit Care. 2010;19(4):357-364. doi:10.4037/ajcc2009961
Examples
# Example 1: Failed Initial Assessment
# GCS 15, but Facial Asymmetry present
barnes_jewish_dysphagia_screen(15, 1, 0, 0)
# Example 2: Passed Initial, Failed Water Test
# Normal anatomy, but coughed during water test
barnes_jewish_dysphagia_screen(15, 0, 0, 0, 1)
# Example 3: Passed Full Screen
# Normal anatomy, no signs on water swallow
barnes_jewish_dysphagia_screen(15, 0, 0, 0, 0)
Behavioral Activity Rating Scale (BARS)
Description
Retrieves the description and clinical status for a given Behavioral Activity Rating Scale (BARS) score. BARS is a validated tool used to assess the severity of agitation in patients, particularly in acute psychiatric or emergency settings. It utilizes a 7-point scale ranging from 1 (Difficult to rouse) to 7 (Violent).
Usage
bars_agitation_score(patient_state_score)
Arguments
patient_state_score |
Numeric (1-7). The observed state of the patient. 1: Difficult or unable to rouse. 2: Asleep but responds normally to verbal or physical contact. 3: Drowsy, appears sedated. 4: Quiet and awake (normal level of activity). 5: Signs of overt (physical or verbal) activity, calms down with instructions. 6: Extremely or continuously active, not requiring restraint. 7: Violent, requires restraint. |
Value
A list containing:
BARS_Score |
The input score. |
Description |
The specific behavioral description associated with the score. |
Clinical_Status |
General categorization (e.g., Sedated, Normal, Agitated). |
References
Swift RH, Harrigan EP, Cappelleri JC, et al. Validation of the Behavioural Activity Rating Scale (BARS): a novel measure of activity in agitated patients. J Psychiatr Res. 2002;36(2):87-95. doi:10.1016/s0022-3956(01)00053-6
Examples
# Example 1: Normal Activity
bars_agitation_score(4)
# Example 2: Severe Agitation
bars_agitation_score(7)
Barthel Index for Activities of Daily Living (ADL)
Description
Calculates the Barthel Index to assess a patient's performance in activities of daily living (ADL). The index measures the degree of assistance required by an individual on 10 items of mobility and self-care. A higher score indicates greater independence.
Usage
barthel_index_adl(feeding, bathing, grooming, dressing, bowels, bladder,
toilet_use, transfers, mobility, stairs)
Arguments
feeding |
Numeric. 0 = Unable, 5 = Needs help cutting/spreading butter, 10 = Independent. |
bathing |
Numeric. 0 = Dependent, 5 = Independent (or in shower). |
grooming |
Numeric. 0 = Needs help, 5 = Independent face/hair/teeth/shaving. |
dressing |
Numeric. 0 = Dependent, 5 = Needs help but can do ~50%, 10 = Independent (including buttons/zips/laces). |
bowels |
Numeric. 0 = Incontinent (or needs enema), 5 = Occasional accident, 10 = Continent. |
bladder |
Numeric. 0 = Incontinent (or catheterized), 5 = Occasional accident, 10 = Continent. |
toilet_use |
Numeric. 0 = Dependent, 5 = Needs some help but can do something, 10 = Independent (on/off, dressing, wiping). |
transfers |
Numeric. 0 = Unable (no sitting balance), 5 = Major help (1-2 people, can sit), 10 = Minor help (verbal or physical), 15 = Independent. |
mobility |
Numeric. 0 = Immobile, 5 = Wheelchair independent (>50 yards), 10 = Walks with help (>50 yards), 15 = Independent (>50 yards). |
stairs |
Numeric. 0 = Unable, 5 = Needs help (verbal/physical), 10 = Independent. |
Value
A list containing:
Barthel_Index_Score |
The calculated total score (Range 0-100). |
Dependency_Level |
Interpretation of the score (Total, Severe, Moderate, Slight Dependence, or Independence). |
References
Mahoney FI, Barthel DW. Functional evaluation: the Barthel Index. Md State Med J. 1965;14:61-65. Shah S, Vanclay F, Cooper B. Improving the sensitivity of the Barthel Index for stroke rehabilitation. J Clin Epidemiol. 1989;42(8):703-709. doi:10.1016/0895-4356(89)90065-6
Examples
# Example 1: Total Dependence
# All 0s
barthel_index_adl(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
# Example 2: Moderate Dependence
# Feeding 10, Bathing 0, Grooming 5, Dressing 5, Bowels 10, Bladder 10,
# Toilet 5, Transfers 10, Mobility 10, Stairs 5
# Score = 70
barthel_index_adl(10, 0, 5, 5, 10, 10, 5, 10, 10, 5)
Basal Energy Expenditure (Harris-Benedict Equation)
Description
Calculates the Basal Energy Expenditure (BEE), which estimates the number of calories a person burns at rest over 24 hours. This function uses the original Harris-Benedict Equation (1919), which is widely used for nutritional assessments.
Usage
basal_energy_expenditure(sex, height_cm, weight_kg, age)
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
height_cm |
Numeric. Patient height in centimeters. |
weight_kg |
Numeric. Patient weight in kilograms. |
age |
Numeric. Patient age in years. |
Value
A list containing:
BEE_kcal_day |
The estimated daily caloric needs at rest. |
Formula |
Specification of the equation used (Harris-Benedict 1919). |
References
Harris JA, Benedict FG. A Biometric Study of Basal Metabolism in Man. Washington DC: Carnegie Institute of Washington. 1919.
Examples
# Example 1: Male
# 180cm, 80kg, 30 years old
# BEE = 66.5 + (13.75*80) + (5.003*180) - (6.755*30) = 66.5 + 1100 + 900.5 - 202.6 = ~1864
basal_energy_expenditure("male", 180, 80, 30)
# Example 2: Female
# 160cm, 60kg, 40 years old
# BEE = 655.1 + (9.56*60) + (1.85*160) - (4.68*40) = 655.1 + 573.6 + 296 - 187.2 = ~1338
basal_energy_expenditure("female", 160, 60, 40)
Basic Statistics Calculator (Diagnostic Test Evaluation)
Description
Calculates standard diagnostic statistics from a 2x2 contingency table (True Positives, False Positives, False Negatives, True Negatives). Metrics include Sensitivity, Specificity, Positive/Negative Predictive Values (PPV/NPV), Likelihood Ratios (LR+/LR-), Accuracy, and Disease Prevalence.
Usage
basic_stats_calculator(tp, fp, fn, tn)
Arguments
tp |
Numeric. Count of True Positives (Disease Present, Test Positive). |
fp |
Numeric. Count of False Positives (Disease Absent, Test Positive). |
fn |
Numeric. Count of False Negatives (Disease Present, Test Negative). |
tn |
Numeric. Count of True Negatives (Disease Absent, Test Negative). |
Value
A list containing:
Diagnostic_Accuracy |
Sensitivity, Specificity, and Overall Accuracy. |
Predictive_Values |
PPV and NPV. |
Likelihood_Ratios |
LR+ (Sensitivity / (1-Specificity)) and LR- ((1-Sensitivity) / Specificity). |
Population_Stats |
Prevalence of disease in the sample and total sample size. |
References
Altman DG, Bland JM. Diagnostic tests 1: Sensitivity and specificity. BMJ. 1994;308(6943):1552. Altman DG, Bland JM. Diagnostic tests 2: Predictive values. BMJ. 1994;309(6947):102.
Examples
# Example 1: Good Test
# TP=80, FP=10, FN=20, TN=90
basic_stats_calculator(80, 10, 20, 90)
# Example 2: Perfect Specificity
# TP=50, FP=0, FN=50, TN=100
# LR+ will be Inf
basic_stats_calculator(50, 0, 50, 100)
Bastion Classification of Lower Limb Blast Injuries
Description
Classifies lower limb injuries caused by blasts (e.g., Improvised Explosive Devices/IEDs) based on the most proximal level of injury. This classification system aids in communicating injury severity, anticipating resource needs (surgical consultations), and guiding hemorrhage control (tourniquet viability).
Usage
bastion_classification_lower_limb(injury_level, segmental_injury = 0,
abdominal_injury = 0, genital_perineal_injury = 0,
pelvic_ring_injury = 0, upper_limb_injury = 0)
Arguments
injury_level |
Numeric (1-5). The most proximal extent of the injury. 1: Injury confined to the foot. 2: Injury involving the lower leg (permits effective below-knee tourniquet). 3: Injury involving proximal lower leg or thigh (permits effective above-knee tourniquet). 4: Proximal thigh injury (prevents effective tourniquet application). 5: Any injury with buttock involvement. |
segmental_injury |
Numeric (0 or 1). Presence of potentially viable tissue distal to the most proximal injury (Segmental Injury). (1 = Yes). |
abdominal_injury |
Numeric (0 or 1). Associated intraperitoneal abdominal injury. (1 = Yes). |
genital_perineal_injury |
Numeric (0 or 1). Associated genitalia or perineal injury. (1 = Yes). |
pelvic_ring_injury |
Numeric (0 or 1). Associated pelvic ring injury. (1 = Yes). |
upper_limb_injury |
Numeric (0 or 1). Associated upper limb injury. (1 = Yes). |
Value
A list containing:
Bastion_Class |
The determined Bastion Class (1-5). |
Description |
Anatomical description of the class. |
Tourniquet_Guide |
Guidance on the feasibility of tourniquet application. |
Associated_Injuries |
List of associated complications present. |
References
Jacobs N, Rourke K, Keene D, et al. Lower limb injuries caused by improvised explosive devices: proposed 'Bastion classification' and prospective validation. Injury. 2012;43(9):1442-1446. doi:10.1016/j.injury.2012.05.001
Examples
# Example 1: Class 3 Injury
# Proximal lower leg injury (Level 3), with upper limb injury
bastion_classification_lower_limb(3, 0, 0, 0, 0, 1)
# Example 2: Class 5 Injury
# Buttock involvement (Level 5), with abdominal and pelvic injury
bastion_classification_lower_limb(5, 0, 1, 0, 1, 0)
Barcelona Clinic Liver Cancer (BCLC) Staging
Description
Determines the BCLC Stage, prognosis, and treatment recommendations for Hepatocellular Carcinoma (HCC). The classification uses Performance Status (ECOG), Tumor Burden, and Liver Function (Child-Pugh) to stratify patients into five stages (0, A, B, C, D).
Usage
bclc_staging(ecog_ps, tumor_characteristics, child_pugh_class)
Arguments
ecog_ps |
Numeric (0-4). ECOG Performance Status. |
tumor_characteristics |
String. Extent of tumor burden. Options: "single_lt_2cm": Single nodule < 2cm. "single_gt_2cm_or_3_lt_3cm": Single nodule >= 2cm OR 3 nodules <= 3cm. "multinodular": Multinodular. "invasion_or_metastasis": Portal invasion or extrahepatic spread. |
child_pugh_class |
String. Child-Pugh Score Class ("A", "B", or "C"). |
Value
A list containing:
BCLC_Stage |
The calculated stage (0, A, B, C, or D). |
Prognosis |
Estimated median survival. |
Treatment_Recommendation |
Guideline-based treatment options. |
References
Llovet JM, Bru C, Bruix J. Prognosis of hepatocellular carcinoma: the BCLC staging classification. Semin Liver Dis. 1999;19(3):329-38. doi:10.1055/s-2007-1007122 Reig M, Forner A, Rimola J, et al. BCLC strategy for prognosis and treatment of hepatocellular carcinoma: The 2022 update. J Hepatol. 2022;76(3):681-693.
Examples
# Example 1: Intermediate Stage
# PS 0, Multinodular, Child-Pugh A
bclc_staging(0, "multinodular", "A")
# Example 2: Advanced Stage
# PS 1, Single >2cm (Tumor burden is early, but PS 1 upgrades stage), Child-Pugh A
bclc_staging(1, "single_gt_2cm_or_3_lt_3cm", "A")
# Example 3: Terminal Stage
# PS 3
bclc_staging(3, "single_lt_2cm", "B")
BeAM Value for Type 2 Diabetes
Description
Calculates the BeAM Value (Bedtime minus AM glucose differential). This simple metric helps determine if a patient with Type 2 Diabetes, currently treated with basal insulin, requires the addition of prandial (mealtime) insulin. A high BeAM value indicates that blood glucose is rising significantly throughout the day (post-prandial spikes), despite adequate overnight control (good AM fasting glucose).
Usage
beam_value_diabetes(bedtime_glucose, am_glucose, units = "mg/dL")
Arguments
bedtime_glucose |
Numeric. Blood glucose level measured at bedtime. |
am_glucose |
Numeric. Fasting blood glucose level measured in the morning (pre-breakfast). |
units |
String. Units of measurement. "mg/dL" (default) or "mmol/L". |
Value
A list containing:
BeAM_Value |
The calculated difference between bedtime and AM glucose. |
Interpretation |
Clinical guidance. A value > 50 mg/dL (or ~2.8 mmol/L) suggests the need for prandial insulin. |
References
Zisman A, Morales F, Stewart J, et al. BeAM value: an indicator of the need to initiate and intensify prandial therapy in patients with type 2 diabetes mellitus receiving basal insulin. BMJ Open Diab Res Care. 2016;4:e000268. doi:10.1136/bmjdrc-2016-000268
Examples
# Example 1: High BeAM Value (Prandial Insulin Needed)
# Bedtime 200 mg/dL, AM Fasting 110 mg/dL
# BeAM = 90 (>50)
beam_value_diabetes(200, 110)
# Example 2: Low BeAM Value (Basal Issue or Controlled)
# Bedtime 130 mg/dL, AM Fasting 120 mg/dL
# BeAM = 10
beam_value_diabetes(130, 120)
Benzodiazepine Conversion Calculator
Description
Calculates the estimated equivalent dose between different benzodiazepines. The calculation typically uses 10 mg of oral Diazepam as the standard reference unit to derive equivalencies for other agents (e.g., based on the Ashton Manual and other clinical pharmacological data).
Usage
benzodiazepine_conversion(source_drug, source_dose, target_drug)
Arguments
source_drug |
String. The name of the benzodiazepine currently being taken. Options: "alprazolam", "chlordiazepoxide", "clobazam", "clonazepam", "clorazepate", "diazepam", "estazolam", "flurazepam", "lorazepam", "midazolam_oral", "midazolam_iv", "nitrazepam", "oxazepam", "quazepam", "temazepam", "triazolam". |
source_dose |
Numeric. The dose of the source drug in milligrams (mg). |
target_drug |
String. The name of the benzodiazepine to convert to. (Same options as source_drug). |
Value
A list containing:
Input |
The provided source drug and dose. |
Output |
The calculated equivalent dose of the target drug. |
Diazepam_Equivalent_mg |
The calculated dose standardized to oral Diazepam. |
Note |
Clinical warning regarding cross-tolerance and variability. |
References
Ashton H. Protocol for the treatment of benzodiazepine withdrawal. University of Newcastle upon Tyne. 2002.
Examples
# Example 1: Convert 1mg Alprazolam to Diazepam
# 0.5mg Alprazolam ~= 10mg Diazepam, so 1mg ~= 20mg
benzodiazepine_conversion("alprazolam", 1, "diazepam")
# Example 2: Convert 2mg Lorazepam to Clonazepam
# 1mg Lorazepam ~= 0.5mg Clonazepam, so 2mg ~= 1mg
benzodiazepine_conversion("lorazepam", 2, "clonazepam")
Berg Balance Scale (BBS)
Description
Calculates the Berg Balance Scale score, a widely used clinical test of a person's static and dynamic balance abilities. The scale consists of 14 functional tasks, each scored from 0 to 4. The total score (0-56) indicates the patient's risk of falling.
Usage
berg_balance_scale(sit_to_stand, standing_unsupported, sitting_unsupported,
stand_to_sit, transfers, standing_eyes_closed,
standing_feet_together, reaching_forward, retrieving_object,
turning_to_look_behind, turning_360, stool_stepping,
tandem_standing, one_leg_stand)
Arguments
sit_to_stand |
Numeric (0-4). Ability to stand up. |
standing_unsupported |
Numeric (0-4). Ability to stand for 2 minutes without holding on. |
sitting_unsupported |
Numeric (0-4). Ability to sit with back unsupported but feet on floor or on a stool. |
stand_to_sit |
Numeric (0-4). Ability to sit down. |
transfers |
Numeric (0-4). Ability to transfer (e.g., bed to chair). |
standing_eyes_closed |
Numeric (0-4). Ability to stand unsupported with eyes closed. |
standing_feet_together |
Numeric (0-4). Ability to stand unsupported with feet together. |
reaching_forward |
Numeric (0-4). Ability to reach forward with outstretched arm while standing. |
retrieving_object |
Numeric (0-4). Ability to pick up an object from the floor from a standing position. |
turning_to_look_behind |
Numeric (0-4). Ability to turn to look behind over left and right shoulders while standing. |
turning_360 |
Numeric (0-4). Ability to turn 360 degrees. |
stool_stepping |
Numeric (0-4). Ability to place alternate foot on a step or stool while standing unsupported. |
tandem_standing |
Numeric (0-4). Ability to stand with one foot in front of the other. |
one_leg_stand |
Numeric (0-4). Ability to stand on one leg. |
Value
A list containing:
BBS_Total_Score |
The sum of the 14 items (Range 0-56). |
Fall_Risk_Classification |
Interpretation: "High Fall Risk" (0-20), "Medium Fall Risk" (21-40), or "Low Fall Risk" (41-56). |
References
Berg KO, Wood-Dauphinee SL, Williams JI, Maki B. Measuring balance in the elderly: validation of an instrument. Can J Public Health. 1992;83 Suppl 2:S7-11.
Examples
# Example 1: Low Fall Risk
# Most items scored 4 or 3
berg_balance_scale(4, 4, 4, 4, 4, 4, 4, 3, 3, 4, 3, 4, 2, 2)
# Example 2: High Fall Risk
# Most items scored 0 or 1
berg_balance_scale(1, 1, 2, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0)
Berlin Criteria for Acute Respiratory Distress Syndrome (ARDS)
Description
Applies the Berlin Definition to diagnostic criteria for ARDS. It evaluates timing, chest imaging, origin of edema, and oxygenation status to classify patients into Mild, Moderate, or Severe ARDS.
Usage
berlin_ards_criteria(timing_within_1_week, bilateral_opacities,
edema_not_cardiac, pao2_fio2_ratio, peep_or_cpap)
Arguments
timing_within_1_week |
Numeric (0 or 1). Onset within 1 week of a known clinical insult or new/worsening respiratory symptoms. (1 = Yes). |
bilateral_opacities |
Numeric (0 or 1). Bilateral opacities on CXR or CT not fully explained by effusions, lobar/lung collapse, or nodules. (1 = Yes). |
edema_not_cardiac |
Numeric (0 or 1). Respiratory failure not fully explained by cardiac failure or fluid overload. (1 = Yes). |
pao2_fio2_ratio |
Numeric. Ratio of arterial partial pressure of oxygen to fraction of inspired oxygen (PaO2/FiO2) in mmHg. Mild: 200 < Ratio <= 300. Moderate: 100 < Ratio <= 200. Severe: Ratio <= 100. |
peep_or_cpap |
Numeric. Positive End-Expiratory Pressure (PEEP) or Continuous Positive Airway Pressure (CPAP) in cmH2O. Must be >= 5 for diagnosis. |
Value
A list containing:
Classification |
The severity class (Mild, Moderate, Severe, or Not ARDS). |
Predicted_Mortality |
Estimated mortality risk based on the Berlin derivation cohort. |
Failure_Reasons |
List of specific criteria that were not met. |
References
The ARDS Definition Task Force. Acute Respiratory Distress Syndrome: The Berlin Definition. JAMA. 2012;307(23):2526-2533. doi:10.1001/jama.2012.5669
Examples
# Example 1: Severe ARDS
# Acute onset, Bilateral infiltrates, Non-cardiac, PF Ratio 80, PEEP 10
berlin_ards_criteria(1, 1, 1, 80, 10)
# Example 2: Not ARDS (PF Ratio too high)
# PF Ratio 350
berlin_ards_criteria(1, 1, 1, 350, 5)
# Example 3: Not ARDS (PEEP too low)
# PEEP 2
berlin_ards_criteria(1, 1, 1, 150, 2)
Hour-Specific Risk for Neonatal Hyperbilirubinemia (Bhutani Nomogram)
Description
Calculates the risk zone for neonatal hyperbilirubinemia based on the Bhutani Nomogram. This tool assesses the risk of developing severe hyperbilirubinemia in infants >= 35 weeks gestational age and birth weight >= 2000g or >= 2500g depending on specific guideline versions. It uses postnatal age in hours and Total Serum Bilirubin (TSB) to stratify infants into Low, Low-Intermediate, High-Intermediate, or High Risk zones.
Usage
bhutani_nomogram_risk(age_hours, total_bilirubin, units = "mg/dL")
Arguments
age_hours |
Numeric. Postnatal age of the infant in hours. (Valid range typically 12-144+ hours). |
total_bilirubin |
Numeric. Total Serum Bilirubin level. |
units |
String. Units for the bilirubin input. Options: "mg/dL" (default) or "umol/L". |
Value
A list containing:
Risk_Zone |
The determined risk category (e.g., "High Intermediate Risk Zone"). |
TSB_mg_dL |
The patient's bilirubin standardized to mg/dL. |
Thresholds_at_Hour |
The calculated 40th, 75th, and 95th percentile bilirubin values for the specific hour provided. |
References
Bhutani VK, Johnson L, Sivieri EM. Predictive ability of a predischarge hour-specific serum bilirubin for subsequent significant hyperbilirubinemia in healthy term and near-term newborns. Pediatrics. 1999;103(1):6-14. doi:10.1542/peds.103.1.6
Examples
# Example 1: High Risk
# 24 hours old, Bilirubin 9.0 mg/dL (High Risk starts > ~8.0)
bhutani_nomogram_risk(24, 9.0)
# Example 2: Low Risk
# 48 hours old, Bilirubin 6.0 mg/dL (< 40th percentile of ~9.3)
bhutani_nomogram_risk(48, 6.0)
Bicarbonate Deficit Calculator
Description
Calculates the total body bicarbonate deficit in patients with metabolic acidosis. This estimate is used to guide replacement therapy with Sodium Bicarbonate. The formula relies on the apparent volume of distribution of bicarbonate (typically estimated as 40-50% of body weight).
Usage
bicarbonate_deficit(weight_kg, current_hco3, desired_hco3 = 24,
volume_distribution_fraction = 0.4)
Arguments
weight_kg |
Numeric. Patient actual body weight in kilograms. |
current_hco3 |
Numeric. Patient's current serum bicarbonate level (mEq/L). |
desired_hco3 |
Numeric. The target serum bicarbonate level (mEq/L). Defaults to 24 mEq/L, though lower targets (e.g., 10-12 mEq/L) are often used in acute severe acidosis to avoid overcorrection. |
volume_distribution_fraction |
Numeric. The apparent volume of distribution for bicarbonate as a fraction of body weight. Defaults to 0.4 (40%). In severe acidosis, this may be higher (0.5 to 0.8). |
Value
A list containing:
Bicarbonate_Deficit_mEq |
The total calculated deficit in milliequivalents. |
Recommended_Initial_Dose_mEq |
50% of the total deficit, representing the standard safety recommendation for the first 24 hours or initial bolus. |
References
Adrogué HJ, Madias NE. Management of life-threatening acid-base disorders. N Engl J Med. 1998;338(1):26-34. doi:10.1056/NEJM199801013380106
Examples
# Example 1: Severe Acidosis
# 70kg patient, current HCO3 8, target 15 (partial correction)
# Deficit = 0.4 * 70 * (15 - 8) = 196 mEq
bicarbonate_deficit(70, 8, 15)
# Example 2: Full Correction Calculation
# 80kg patient, current 12, target 24
# Deficit = 0.4 * 80 * (24 - 12) = 384 mEq
bicarbonate_deficit(80, 12, 24)
Binet Staging System for Chronic Lymphocytic Leukemia (CLL)
Description
Classifies Chronic Lymphocytic Leukemia (CLL) into three prognostic stages (A, B, or C) based on the number of involved lymphoid areas and the presence of anemia or thrombocytopenia.
Usage
binet_staging_cll(hemoglobin_g_dl, platelets_per_ul, cervical_nodes,
axillary_nodes, inguinal_nodes, liver_spleen_palpable)
Arguments
hemoglobin_g_dl |
Numeric. Hemoglobin level in g/dL. (Threshold < 10 g/dL). |
platelets_per_ul |
Numeric. Platelet count. (Threshold < 100,000/uL). |
cervical_nodes |
Numeric (0 or 1). Enlargement of cervical lymph nodes. (1 = Yes). |
axillary_nodes |
Numeric (0 or 1). Enlargement of axillary lymph nodes. (1 = Yes). |
inguinal_nodes |
Numeric (0 or 1). Enlargement of inguinal lymph nodes. (1 = Yes). |
liver_spleen_palpable |
Numeric (0 or 1). Palpable hepatomegaly or splenomegaly. (1 = Yes). |
Value
A list containing:
Binet_Stage |
The calculated stage (A, B, or C). |
Criteria_Description |
Description of the specific criteria met. |
Median_Survival |
Estimated median survival based on historical data. |
References
Binet JL, Auquier A, Dighiero G, et al. A new prognostic classification of chronic lymphocytic leukemia derived from a multivariate survival analysis. Cancer. 1981;48(1):198-206. doi:10.1002/1097-0142(19810701)48:1<198::aid-cncr2820480131>3.0.co;2-v
Examples
# Example 1: Stage C
# Hb 9.0 (Anemia), Plt 150k, 1 area involved
binet_staging_cll(9.0, 150000, 1, 0, 0, 0)
# Example 2: Stage A
# Hb 14, Plt 200k, 1 area involved (Cervical)
binet_staging_cll(14, 200000, 1, 0, 0, 0)
# Example 3: Stage B
# Hb 13, Plt 180k, 3 areas involved (Cervical, Axillary, Spleen)
binet_staging_cll(13, 180000, 1, 1, 0, 1)
BISAP Score for Pancreatitis Mortality
Description
Calculates the BISAP (Bedside Index for Severity in Acute Pancreatitis) score to estimate in-hospital mortality risk. This simple 5-point scoring system uses data available within the first 24 hours of admission.
Usage
bisap_score(bun, impaired_mental_status, sirs_criteria_met, age,
pleural_effusion, bun_units = "mg/dL")
Arguments
bun |
Numeric. Blood Urea Nitrogen level. (> 25 mg/dL adds +1 point). |
impaired_mental_status |
Numeric (0 or 1). Evidence of impaired mental status (Glasgow Coma Scale < 15). (1 = Yes, +1 point). |
sirs_criteria_met |
Numeric (0 or 1). Does the patient meet >= 2 SIRS criteria? (1 = Yes, +1 point). |
age |
Numeric. Patient age in years. (> 60 years adds +1 point). |
pleural_effusion |
Numeric (0 or 1). Presence of pleural effusion on imaging. (1 = Yes, +1 point). |
bun_units |
String. Units for BUN. "mg/dL" (default) or "mmol/L". |
Value
A list containing:
BISAP_Score |
The calculated score (Range 0-5). |
Mortality_Risk |
Risk stratification (Low vs. High). |
References
Wu BU, Johannes RS, Sun X, Tabak Y, Conwell DL, Banks PA. The early prediction of mortality in acute pancreatitis: a large population-based study. Gut. 2008;57(12):1698-1703. doi:10.1136/gut.2008.152702
Examples
# Example 1: High Risk
# BUN 30 (+1), Altered mental status (+1), SIRS (+1), Age 65 (+1), No effusion
# Score = 4
bisap_score(30, 1, 1, 65, 0)
# Example 2: Low Risk
# BUN 15 (0), Normal mental status (0), No SIRS (0), Age 40 (0), No effusion (0)
# Score = 0
bisap_score(15, 0, 0, 40, 0)
Bishop Score for Vaginal Delivery / Induction of Labor
Description
Calculates the Bishop Score to assess cervical readiness for induction of labor. The score evaluates five parameters: Dilation, Effacement, Station, Consistency, and Position of the cervix. A higher score indicates a more favorable cervix and a higher likelihood of successful vaginal delivery.
Usage
bishop_score_induction(dilation_cm, effacement_percent, station,
consistency, position)
Arguments
dilation_cm |
Numeric. Cervical dilation in centimeters. 0 cm: 0 pts. 1-2 cm: 1 pt. 3-4 cm: 2 pts. >= 5 cm: 3 pts. |
effacement_percent |
Numeric. Cervical effacement percentage. 0-30%: 0 pts. 40-50%: 1 pt. 60-70%: 2 pts. >= 80%: 3 pts. |
station |
Numeric. Fetal station relative to ischial spines (-3 to +2). -3: 0 pts. -2: 1 pt. -1, 0: 2 pts. +1, +2: 3 pts. |
consistency |
String. Consistency of the cervix. Options: "firm" (0 pts), "medium" (1 pt), "soft" (2 pts). |
position |
String. Position of the cervix. Options: "posterior" (0 pts), "midposition" (1 pt), "anterior" (2 pts). |
Value
A list containing:
Bishop_Score |
The calculated total score (Range 0-13). |
Interpretation |
Clinical assessment of inducibility (Favorable > 8, Unfavorable < 6). |
References
Bishop EH. Pelvic scoring for elective induction. Obstet Gynecol. 1964;24:266-268.
Examples
# Example 1: Unfavorable Cervix
# Closed, 30% effaced, -3 station, Firm, Posterior
# Score = 0
bishop_score_induction(0, 30, -3, "firm", "posterior")
# Example 2: Favorable Cervix
# 4cm dilated (2), 60% effaced (2), -1 station (2), Soft (2), Anterior (2)
# Score = 10
bishop_score_induction(4, 60, -1, "soft", "anterior")
Blast Lung Injury Severity Score (BLISS)
Description
Calculates the Blast Lung Injury Severity Score to stratify patients with primary blast lung injury (PBLI). The score guides ventilator management strategies based on the severity of lung injury, assessing oxygenation (PaO2/FiO2), chest x-ray findings, and the presence of a bronchopleural fistula.
Usage
blast_lung_injury_severity(pao2_fio2_ratio, chest_xray_findings,
bronchopleural_fistula)
Arguments
pao2_fio2_ratio |
Numeric. The ratio of arterial partial pressure of oxygen to fraction of inspired oxygen (PaO2/FiO2). > 200: 0 points. 60 - 200: 2 points. < 60: 4 points. |
chest_xray_findings |
Numeric (0-2). Findings on Chest X-ray. 0: Localized lung infiltrates (1 point). 1: Bilateral or unilateral lung infiltrates (not massive bilateral) (2 points). 2: Massive bilateral lung infiltrates (3 points). |
bronchopleural_fistula |
Numeric (0 or 1). Presence of a Bronchopleural Fistula. (1 = Yes, +1 point). |
Value
A list containing:
BLISS_Score |
The calculated total score. |
Severity_Category |
Classification (Mild, Moderate, Severe). |
Ventilator_Management |
Recommendations for mechanical ventilation settings (PEEP, modes) based on severity. |
References
Pizov R, Oppenheim-Eden A, Matot I, et al. Blast lung injury from explosion of a bomb in a civilian bus. Chest. 1999;115(1):165-172. doi:10.1378/chest.115.1.165
Examples
# Example 1: Moderate Injury
# PF 150 (2 pts), Bilateral infiltrates (2 pts), No BPF (0 pts)
# Score = 4
blast_lung_injury_severity(150, 1, 0)
# Example 2: Severe Injury
# PF 50 (4 pts), Massive bilateral (3 pts), BPF present (1 pt)
# Score = 8
blast_lung_injury_severity(50, 2, 1)
Estimated Blood Volume (Nadler Equation)
Description
Calculates the estimated total blood volume in Liters using the Nadler equation. This method is considered more accurate than simple weight-based estimates (e.g., 70 mL/kg) because it accounts for the patient's height and sex. Accurate blood volume estimation is critical for procedures like plasmapheresis or assessing volume status in shock.
Usage
blood_volume_calculation(sex, height_cm, weight_kg)
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
height_cm |
Numeric. Patient height in centimeters. |
weight_kg |
Numeric. Patient weight in kilograms. |
Value
A list containing:
Estimated_Blood_Volume_L |
The calculated total blood volume in Liters. |
Formula |
The method used (Nadler Equation). |
References
Nadler SB, Hidalgo JH, Bloch T. Prediction of blood volume in normal human adults. Surgery. 1962;51(2):224-232.
Examples
# Example 1: Male
# 180cm, 80kg
# BV = (0.3669 * 1.8^3) + (0.03219 * 80) + 0.6041 = ~5.3 L
blood_volume_calculation("male", 180, 80)
# Example 2: Female
# 160cm, 60kg
# BV = (0.3561 * 1.6^3) + (0.03308 * 60) + 0.1833 = ~3.6 L
blood_volume_calculation("female", 160, 60)
BODE Index for COPD Survival
Description
Calculates the BODE Index, a multidimensional scoring system to predict mortality in patients with Chronic Obstructive Pulmonary Disease (COPD). The score evaluates Body mass index, Obstruction (FEV1), Dyspnea (mMRC), and Exercise capacity (6MWD).
Usage
bode_index_copd(bmi, fev1_percent_predicted, mmrc_scale,
six_minute_walk_distance_m)
Arguments
bmi |
Numeric. Body Mass Index (kg/m^2). (> 21: 0 pts; <= 21: 1 pt). |
fev1_percent_predicted |
Numeric. FEV1 percent predicted. (>= 65: 0 pts; 50-64: 1 pt; 36-49: 2 pts; <= 35: 3 pts). |
mmrc_scale |
Numeric (0-4). Modified Medical Research Council (mMRC) Dyspnea Scale. 0-1: 0 pts. 2: 1 pt. 3: 2 pts. 4: 3 pts. |
six_minute_walk_distance_m |
Numeric. 6-Minute Walk Distance in meters. (>= 350: 0 pts; 250-349: 1 pt; 150-249: 2 pts; <= 149: 3 pts). |
Value
A list containing:
BODE_Index |
The calculated score (Range 0-10). |
Est_4_Year_Survival |
Estimated 4-year survival probability. |
References
Celli BR, Cote CG, Marin JM, et al. The body-mass index, airflow obstruction, dyspnea, and exercise capacity index in chronic obstructive pulmonary disease. N Engl J Med. 2004;350(10):1005-1012. doi:10.1056/NEJMoa021322
Examples
# Example 1: Severe COPD (High Mortality Risk)
# BMI 20 (+1), FEV1 30% (+3), mMRC 3 (+2), 6MWD 140m (+3)
# Score = 9
bode_index_copd(20, 30, 3, 140)
# Example 2: Moderate COPD
# BMI 25 (0), FEV1 55% (+1), mMRC 1 (0), 6MWD 300m (+1)
# Score = 2
bode_index_copd(25, 55, 1, 300)
Body Fluid Balance Calculator
Description
Calculates the net fluid balance over a specified period (typically 24 hours) by summing all sources of fluid intake (Input) and subtracting all sources of fluid loss (Output). This calculation is critical for monitoring hydration status in hospitalized patients, particularly those with heart failure, kidney disease, or shock.
Usage
body_fluid_balance(oral_input_ml = 0, iv_input_ml = 0, enteral_input_ml = 0,
other_input_ml = 0, urine_output_ml = 0, stool_output_ml = 0,
emesis_ng_output_ml = 0, drain_output_ml = 0,
insensible_loss_ml = 0)
Arguments
oral_input_ml |
Numeric. Total volume of fluid consumed orally (PO) in milliliters. |
iv_input_ml |
Numeric. Total volume of intravenous (IV) fluids administered in milliliters (including continuous infusions, boluses, and medication volumes). |
enteral_input_ml |
Numeric. Total volume of enteral nutrition (tube feeds) and water flushes in milliliters. |
other_input_ml |
Numeric. Any other fluid intake (e.g., blood products) in milliliters. |
urine_output_ml |
Numeric. Total volume of urine produced in milliliters. |
stool_output_ml |
Numeric. Estimated volume of liquid stool or ostomy output in milliliters. |
emesis_ng_output_ml |
Numeric. Volume of vomit or nasogastric (NG) tube output in milliliters. |
drain_output_ml |
Numeric. Volume from surgical drains, chest tubes, etc., in milliliters. |
insensible_loss_ml |
Numeric. Estimated insensible losses (skin, respiration) in milliliters. Often estimated as 500-800 mL/day or 10 mL/kg/day in adults, though highly variable with fever or ventilation. |
Value
A list containing:
Net_Fluid_Balance_mL |
The calculated balance (Input - Output). |
Status |
Description of the balance (Positive, Negative, or Neutral). |
Summary |
Total summed Input and Output values. |
Detailed_Inputs |
Breakdown of input sources. |
Detailed_Outputs |
Breakdown of output sources. |
References
Mazzoni D, et al. Fluid Balance. In: StatPearls. Treasure Island (FL): StatPearls Publishing. 2023.
Examples
# Example 1: Positive Balance (Fluid Overload concern)
# 2L IV, 500mL Oral, 1L Urine, no other losses
body_fluid_balance(oral_input_ml = 500, iv_input_ml = 2000, urine_output_ml = 1000)
# Example 2: Negative Balance (Dehydration/Diuresis)
# 1L Oral, 2L Urine, 500mL Insensible
body_fluid_balance(oral_input_ml = 1000, urine_output_ml = 2000, insensible_loss_ml = 500)
Body Mass Index (BMI) and Body Surface Area (BSA)
Description
Calculates the Body Mass Index (BMI) and estimates Body Surface Area (BSA) using five common formulas (Mosteller, Du Bois, Haycock, Gehan-George, and Boyd). These metrics are fundamental for dosing medications (e.g., chemotherapy), assessing nutritional status, and stratifying obesity risks.
Usage
body_mass_index_bsa(weight_kg, height_cm)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. |
height_cm |
Numeric. Patient height in centimeters. |
Value
A list containing:
BMI_kg_m2 |
Calculated BMI (Weight / Height^2). |
BMI_Category |
Classification based on WHO guidelines (Underweight, Normal, Overweight, Obesity Class I-III). |
BSA_Mosteller_m2 |
BSA calculated using the Mosteller formula (Standard for many applications). |
BSA_DuBois_m2 |
BSA calculated using the Du Bois & Du Bois formula. |
BSA_Haycock_m2 |
BSA calculated using the Haycock formula (Often preferred in pediatrics). |
BSA_Gehan_George_m2 |
BSA calculated using the Gehan-George formula. |
BSA_Boyd_m2 |
BSA calculated using the Boyd formula. |
References
Mosteller RD. Simplified calculation of body-surface area. N Engl J Med. 1987;317(17):1098. doi:10.1056/NEJM198710223171717
Du Bois D, Du Bois EF. A formula to estimate the approximate surface area if height and weight be known. Arch Intern Med. 1916;17(6):863-871.
Examples
# Example 1: Average Adult
# 75 kg, 175 cm
body_mass_index_bsa(75, 175)
# Example 2: Child
# 30 kg, 130 cm
body_mass_index_bsa(30, 130)
Body Roundness Index (BRI)
Description
Calculates the Body Roundness Index (BRI), a geometric measure of body composition that models the human body as an ellipse. BRI improves upon Body Mass Index (BMI) by quantifying the degree of central adiposity (visceral fat), which is a stronger predictor of metabolic syndrome, cardiovascular disease, and all-cause mortality.
Usage
body_roundness_index(waist_cm, height_cm)
Arguments
waist_cm |
Numeric. Waist circumference in centimeters. |
height_cm |
Numeric. Height in centimeters. |
Value
A list containing:
BRI_Score |
The calculated Body Roundness Index. Scores range from 1 to roughly 20. Higher scores indicate greater central adiposity and a rounder body shape. |
References
Thomas DM, Bredlau C, Bosy-Westphal A, et al. Relationships between body roundness with body fat and visceral adipose tissue emerging from a new geometric model. Obesity (Silver Spring). 2013;21(11):2264-2271. doi:10.1002/oby.20408
Examples
# Example 1: Average measurements
# Waist 85 cm, Height 175 cm
body_roundness_index(85, 175)
# Example 2: High central adiposity
# Waist 110 cm, Height 170 cm
body_roundness_index(110, 170)
Ideal Body Weight (IBW) and Adjusted Body Weight (ABW)
Description
Calculates Ideal Body Weight (using the Devine Formula) and Adjusted Body Weight. These metrics are essential for calculating nutritional needs and dosing medications (e.g., aminoglycosides, acyclovir) in patients who are obese or have abnormal body composition.
Usage
body_weight_calculations(sex, height, actual_weight,
height_units = "in", weight_units = "kg")
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
height |
Numeric. Patient height. |
actual_weight |
Numeric. Patient's current actual body weight. |
height_units |
String. Units for height input. Options: "in" (default) or "cm". |
weight_units |
String. Units for weight input. Options: "kg" (default) or "lbs". |
Value
A list containing:
Ideal_Body_Weight_kg |
Calculated IBW based on Devine formula. |
Adjusted_Body_Weight_kg |
Calculated ABW (IBW + 0.4 * (Actual - IBW)). |
Actual_Body_Weight_kg |
Standardized actual weight in kg. |
Percent_Over_IBW |
The percentage by which actual weight exceeds IBW. |
Dosing_Suggestion |
Logic suggesting which weight to use for dosing based on obesity status. |
References
Devine BJ. Gentamicin therapy. Drug Intell Clin Pharm. 1974;8:650–655.
Examples
# Example 1: Male, Normal Weight (70 in, 75 kg)
body_weight_calculations("male", 70, 75)
# Example 2: Female, Obese (160 cm, 90 kg)
# Height ~63 in. IBW = 45.5 + 2.3(3) = 52.4 kg.
# Actual 90 kg. ABW = 52.4 + 0.4(90-52.4) = 67.4 kg.
body_weight_calculations("female", 160, 90, "cm", "kg")
Behavioral Observational Pain Scale (BOPS)
Description
Calculates the Behavioral Observational Pain Scale (BOPS) score for assessing postoperative pain in children aged 1-7 years. The scale evaluates three behavioral domains: Facial Expression, Verbalization, and Body Position. A score of 3 or greater typically indicates the need for analgesic intervention.
Usage
bops_pediatric_pain(facial_expression, verbalization, body_position)
Arguments
facial_expression |
Numeric (0-2). 0: Neutral, positive, or smiling. 1: Negative facial expression. 2: Grimace. |
verbalization |
Numeric (0-2). 0: Normal conversation, silence, laughter, or crying not related to pain. 1: Complaining, moaning, or whimpering. 2: Crying or screaming related to pain. |
body_position |
Numeric (0-2). 0: Lying quietly, normal position, or moves easily. 1: Restless, shifting, or touching wound. 2: Rigid or protecting wound. |
Value
A list containing:
BOPS_Score |
The calculated total score (Range 0-6). |
Interpretation |
Clinical guidance based on the threshold of 3. |
References
Hesselgard K, Larsson S, Romner B, Strömblad LG, Reinstrup P. Validity and reliability of the Behavioural Observational Pain Scale for postoperative pain measurement in children 1-7 years of age. Pediatr Crit Care Med. 2007;8(2):102-108. doi:10.1097/01.PCC.0000257098.32286.2D
Examples
# Example 1: Significant Pain
# Grimace (2), Crying (2), Restless (1)
# Score = 5
bops_pediatric_pain(2, 2, 1)
# Example 2: No Pain
# Smiling (0), Normal talk (0), Moving easily (0)
# Score = 0
bops_pediatric_pain(0, 0, 0)
Bova Score for Pulmonary Embolism Complications
Description
Calculates the Bova Score to stratify the risk of PE-related complications (death, hemodynamic collapse, or recurrent PE) within 30 days in normotensive patients with acute pulmonary embolism. This tool helps identify patients who, despite being hemodynamically stable at presentation, are at intermediate-to-high risk for deterioration.
Usage
bova_pe_score(sbp, heart_rate, troponin_elevated, rv_dysfunction)
Arguments
sbp |
Numeric. Systolic Blood Pressure in mmHg. (90-100 mmHg adds +2 points). |
heart_rate |
Numeric. Heart rate in beats per minute. (>= 110 bpm adds +1 point). |
troponin_elevated |
Numeric (0 or 1). Cardiac troponin elevated above the institutional upper limit of normal. (1 = Yes, +2 points). |
rv_dysfunction |
Numeric (0 or 1). Right Ventricular dysfunction visible on echocardiogram or CT. (1 = Yes, +2 points). |
Value
A list containing:
Bova_Score |
The calculated score (Range 0-7). |
Risk_Stage |
Risk classification (Stage I: 0-2, Stage II: 3-4, Stage III: >4). |
PE_Related_Complication_Risk_30Day |
Estimated percentage risk of complications within 30 days. |
References
Bova C, Sanchez O, Prandoni P, et al. Identification of intermediate-risk patients with acute symptomatic pulmonary embolism. Eur Heart J. 2014;35(20):1348-1356. doi:10.1093/eurheartj/ehu007
Examples
# Example 1: High Risk (Stage III)
# SBP 95 (+2), HR 115 (+1), Troponin Neg (0), RV Dysfx (+2)
# Score = 5
bova_pe_score(95, 115, 0, 1)
# Example 2: Low Risk (Stage I)
# SBP 120 (0), HR 90 (0), Troponin Pos (+2), RV Normal (0)
# Score = 2
bova_pe_score(120, 90, 1, 0)
Behavioral Pain Scale (BPS) for Intubated Patients
Description
Calculates the Behavioral Pain Scale (BPS) score to assess pain in unconscious, sedated, and intubated patients. The scale evaluates three behavioral domains: Facial Expression, Upper Limb Movements, and Compliance with Mechanical Ventilation.
Usage
bps_intubated_pain(facial_expression, upper_limb_movements, compliance_ventilation)
Arguments
facial_expression |
Numeric (1-4). 1: Relaxed. 2: Partially tightened (e.g., brow lowering). 3: Fully tightened (e.g., eyelid closing). 4: Grimacing. |
upper_limb_movements |
Numeric (1-4). 1: No movement. 2: Partially bent. 3: Fully bent with finger flexion. 4: Permanently retracted. |
compliance_ventilation |
Numeric (1-4). 1: Tolerating movement. 2: Coughing but tolerating ventilation most of the time. 3: Fighting ventilator. 4: Unable to control ventilation. |
Value
A list containing:
BPS_Score |
The sum of the three domain scores (Range 3-12). |
Interpretation |
Clinical guidance. A score > 5 generally indicates significant pain requiring intervention. |
References
Payen JF, Bru O, Bosson JL, et al. Assessing pain in critically ill sedated patients by using a behavioral pain scale. Crit Care Med. 2001;29(12):2258-2263. doi:10.1097/00003246-200112000-00004
Examples
# Example 1: Significant Pain
# Grimacing (4), Fully bent arms (3), Fighting vent (3)
# Score = 10
bps_intubated_pain(4, 3, 3)
# Example 2: No Pain
# Relaxed (1), No movement (1), Tolerating vent (1)
# Score = 3
bps_intubated_pain(1, 1, 1)
Braden Score for Pressure Ulcer Risk
Description
Calculates the Braden Score, a widely used tool for assessing the risk of developing pressure ulcers (bedsores) in adult patients. The scale evaluates six subscales: sensory perception, moisture, activity, mobility, nutrition, and friction/shear. Lower scores indicate higher risk.
Usage
braden_score(sensory_perception, moisture, activity, mobility,
nutrition, friction_shear)
Arguments
sensory_perception |
Numeric (1-4). Ability to respond meaningfully to pressure-related discomfort. 1: Completely Limited (Unresponsive). 2: Very Limited (Responds only to painful stimuli). 3: Slightly Limited (Responds to verbal commands). 4: No Impairment. |
moisture |
Numeric (1-4). Degree to which skin is exposed to moisture. 1: Constantly Moist. 2: Very Moist (Often). 3: Occasionally Moist. 4: Rarely Moist. |
activity |
Numeric (1-4). Degree of physical activity. 1: Bedfast. 2: Chairfast. 3: Walks Occasionally. 4: Walks Frequently. |
mobility |
Numeric (1-4). Ability to change and control body position. 1: Completely Immobile. 2: Very Limited. 3: Slightly Limited. 4: No Limitation. |
nutrition |
Numeric (1-4). Usual food intake pattern. 1: Very Poor. 2: Probably Inadequate. 3: Adequate. 4: Excellent. |
friction_shear |
Numeric (1-3). Friction and shear problem. 1: Problem (Requires moderate/max assist). 2: Potential Problem. 3: No Apparent Problem. |
Value
A list containing:
Braden_Score |
The calculated total score (Range 6-23). |
Risk_Category |
Risk classification (Severe Risk <=9, High 10-12, Moderate 13-14, Mild 15-18, No Risk 19-23). |
References
Bergstrom N, Braden BJ, Laguzza A, Holman V. The Braden Scale for Predicting Pressure Sore Risk. Nurs Res. 1987;36(4):205-210.
Examples
# Example 1: High Risk Patient
# Unresponsive (1), Constantly moist (1), Bedfast (1), Immobile (1), Poor nutrition (1), Sliding (1)
# Score = 6
braden_score(1, 1, 1, 1, 1, 1)
# Example 2: Mild Risk
# Slightly limited sensory (3), Occasional moisture (3), Walks occasionally (3),
# Slightly limited mobility (3), Adequate nutrition (3), No friction (3)
# Score = 18
braden_score(3, 3, 3, 3, 3, 3)
Brain Metastasis Velocity (BMV) Model
Description
Calculates the Brain Metastasis Velocity (BMV) score, a prognostic metric used to predict overall survival in patients who develop new brain metastases (distant brain failure) after initial stereotactic radiosurgery (SRS). The score is defined as the cumulative number of new brain metastases developed since initial SRS divided by the time interval (in years) since that initial treatment.
Usage
brain_metastasis_velocity(new_mets_count, time_interval_years)
Arguments
new_mets_count |
Numeric. The total cumulative number of new brain metastases detected since the initial SRS treatment. |
time_interval_years |
Numeric. The time interval between the initial SRS treatment and the appearance/diagnosis of the new brain metastases, measured in years. |
Value
A list containing:
BMV_Score |
The calculated velocity (mets/year). |
Risk_Class |
Risk stratification (Low < 4, Intermediate 4-13, High > 13). |
Median_Overall_Survival |
Estimated median survival from the time of salvage SRS, based on the multi-institutional validation cohort. |
References
Farris M, McTyre ER, Chuong M, et al. Brain Metastasis Velocity: A Novel Prognostic Metric Predictive of Overall Survival and Freedom From Neurologic Death After Distant Brain Failure Following Upfront Radiosurgery Alone. Int J Radiat Oncol Biol Phys. 2017;98(1):131-141. doi:10.1016/j.ijrobp.2017.01.229
Examples
# Example 1: Low Risk
# 2 new mets appearing 1 year after initial SRS
# BMV = 2 / 1 = 2
brain_metastasis_velocity(2, 1.0)
# Example 2: High Risk
# 8 new mets appearing 0.5 years (6 months) after initial SRS
# BMV = 8 / 0.5 = 16
brain_metastasis_velocity(8, 0.5)
Breast-GPA for Brain Metastasis Survival
Description
Calculates the Diagnosis-Specific Graded Prognostic Assessment (Breast-GPA) score. This tool estimates the median survival of patients with breast cancer who have developed brain metastases. The score is based on tumor subtype (ER/PR/HER2), Karnofsky Performance Status (KPS), age, and the presence of extracranial metastases.
Usage
breast_cancer_brain_metastasis_gpa(subtype_er_pr_status, subtype_her2_status,
kps, age, extracranial_metastases,
number_of_brain_metastases)
Arguments
subtype_er_pr_status |
String. Estrogen/Progesterone Receptor status. "positive" or "negative". |
subtype_her2_status |
String. HER2 Receptor status. "positive" or "negative". |
kps |
Numeric. Karnofsky Performance Status (0-100). <70: 0 pts. 70-80: 0.5 pts. 90-100: 1.0 pts. |
age |
Numeric. Patient age in years. >=60: 0 pts. <60: 0.5 pts. |
extracranial_metastases |
Numeric (0 or 1). Presence of extracranial metastases. (1 = Present [0 pts], 0 = Absent [0.5 pts]). |
number_of_brain_metastases |
Numeric. Number of brain metastases. (>1: 0 pts, 1: 0.5 pts). |
Value
A list containing:
Breast_GPA_Score |
The calculated total score (Range 0.0 - 4.0). |
Estimated_Median_Survival |
Estimated median survival time in months. |
References
Sperduto PW, Kased N, Roberge D, et al. Summary report on the graded prognostic assessment: an accurate and facile diagnosis-specific tool to estimate survival for patients with brain metastases. J Clin Oncol. 2012;30(4):419-425. doi:10.1200/JCO.2011.36.6972
Examples
# Example 1: Poor Prognosis (Basal Type)
# Triple Negative (0), KPS 60 (0), Age 65 (0), ECM Present (0), Multiple Mets (0)
# Score = 0
breast_cancer_brain_metastasis_gpa("negative", "negative", 60, 65, 1, 3)
# Example 2: Good Prognosis (Luminal B)
# ER+ HER2+ (2.0), KPS 90 (1.0), Age 50 (0.5), No ECM (0.5), Single Met (0.5)
# Score = 4.0
breast_cancer_brain_metastasis_gpa("positive", "positive", 90, 50, 0, 1)
Brescia-COVID Respiratory Severity Scale (BCRSS)
Description
Implements the Brescia-COVID Respiratory Severity Scale Algorithm. This stepwise approach helps triage COVID-19 patients based on respiratory symptoms, oxygenation status, and chest imaging to determine the appropriate level of respiratory support (Observation, O2, or NIV/Intubation).
Usage
brescia_covid_severity(wheezing_present, rr_gt_22_or_desat,
worsening_cxr_or_unstable)
Arguments
wheezing_present |
Numeric (0 or 1). Is wheezing present on auscultation? (1 = Yes - suggests Asthma/COPD pathway). |
rr_gt_22_or_desat |
Numeric (0 or 1). Is Respiratory Rate > 22 bpm OR SpO2 < 90% on room air? (1 = Yes). |
worsening_cxr_or_unstable |
Numeric (0 or 1). Despite supplemental oxygen, is SpO2 < 90% OR is there significant worsening on Chest X-ray? (1 = Yes). |
Value
A list containing:
BCRSS_Severity_Level |
The calculated severity tier (0-3). |
Management_Recommendation |
Clinical guidance for respiratory support escalation. |
References
Piva S, Filippini M, Turla F, et al. Clinical presentation and initial management of COVID-19 patients in Brescia, Italy. Anaesthesia. 2020.
Examples
# Example 1: High Severity (Need NIV/ICU)
# No wheeze, Tachypneic, Worsening despite O2
brescia_covid_severity(0, 1, 1)
# Example 2: Mild/Observation
# No wheeze, Normal RR/SpO2
brescia_covid_severity(0, 0, 0)
Brief Addiction Monitor (BAM)
Description
Calculates domain scores for the Brief Addiction Monitor (BAM), a 17-item instrument used to monitor progress in recovery from substance use disorders. It evaluates three key domains over the past 30 days: Substance Use, Risk Factors, and Protective Factors.
Usage
brief_addiction_monitor(alcohol_days, drug_days, marijuana_days,
risk_health, risk_sleep, risk_anxiety, risk_depression,
risk_cravings, risk_situations,
prot_confidence, prot_support, prot_spiritual,
prot_work, prot_income, prot_family,
prot_self_help_days, prot_commitment)
Arguments
alcohol_days |
Numeric (0-30). Days of alcohol use in the past 30 days. |
drug_days |
Numeric (0-30). Days of illegal drug use in the past 30 days. |
marijuana_days |
Numeric (0-30). Days of marijuana use in the past 30 days. |
risk_health |
Numeric (0-4). Rating of poor physical health (0=Not at all, 4=Extremely). |
risk_sleep |
Numeric (0-4). Rating of sleep problems. |
risk_anxiety |
Numeric (0-4). Rating of anxiety/tension. |
risk_depression |
Numeric (0-4). Rating of depression/sadness. |
risk_cravings |
Numeric (0-4). Rating of cravings/urges to use. |
risk_situations |
Numeric (0-4). Rating of exposure to risky situations. |
prot_confidence |
Numeric (0-4). Rating of confidence in staying sober. |
prot_support |
Numeric (0-4). Rating of support for recovery. |
prot_spiritual |
Numeric (0-4). Rating of spiritual support. |
prot_work |
Numeric (0-4). Rating of satisfaction with work/school progress. |
prot_income |
Numeric (0-4). Rating of income sufficiency. |
prot_family |
Numeric (0-4). Rating of family/friend support. |
prot_self_help_days |
Numeric (0-30). Days of attendance at self-help groups (AA/NA/SMART) in the past 30 days. |
prot_commitment |
Numeric (0-4). Rating of commitment to sobriety. |
Value
A list containing:
Use_Total_Days |
Sum of days using Alcohol, Drugs, and Marijuana. |
Risk_Score_Total |
Sum of the 6 risk items (Range 0-24). |
Protective_Likert_Sum |
Sum of the 7 Likert-scale protective items (Range 0-28). |
Self_Help_Days |
Raw count of self-help days (0-30). |
References
Cacciola JS, Alterman AI, Dephilippis D, et al. Development and initial evaluation of the Brief Addiction Monitor (BAM). J Subst Abuse Treat. 2013;44(3):256-263. doi:10.1016/j.jsat.2012.07.013
Examples
# Example 1: High Risk Profile
# 15 days alcohol, High cravings (4), Low confidence (1)
brief_addiction_monitor(15, 0, 0, 2, 2, 3, 3, 4, 3, 1, 1, 0, 2, 1, 1, 0, 1)
# Example 2: Strong Recovery Profile
# 0 days use, Low risk factors, High protection, 12 days self-help
brief_addiction_monitor(0, 0, 0, 0, 0, 1, 0, 1, 0, 4, 4, 3, 4, 3, 4, 12, 4)
Brief Alcohol Withdrawal Scale (BAWS)
Description
Calculates the Brief Alcohol Withdrawal Scale (BAWS) score, a streamlined tool for assessing the severity of alcohol withdrawal syndrome (AWS) and guiding symptom-triggered benzodiazepine therapy. The scale evaluates 5 clinical items, each scored from 0 to 3.
Usage
brief_alcohol_withdrawal_scale(tremor, sweating, agitation, orientation,
hallucinations)
Arguments
tremor |
Numeric (0-3). 0: No tremor. 1: Not visible, but can be felt (fingertip to fingertip). 2: Moderate, visible with arms extended. 3: Severe, visible at rest without arms extended. |
sweating |
Numeric (0-3). Diaphoresis. 0: No sweats. 1: Mild, barely visible / moist palms. 2: Moderate, beads of sweat visible. 3: Drenching sweats. |
agitation |
Numeric (0-3). Based on RASS. 0: Alert and calm (RASS 0). 1: Restless, anxious, apprehensive (RASS +1). 2: Agitated, frequent non-purposeful movement (RASS +2). 3: Very agitated, combative, violent (RASS +3 or +4). |
orientation |
Numeric (0-3). Confusion/Sensorium. 0: Oriented to person, place, and time. 1: Disoriented to time OR place (but not both). 2: Disoriented to time AND place. 3: Disoriented to person. |
hallucinations |
Numeric (0-3). Visual, auditory, or tactile. 0: None. 1: Mild (vague report, reality testing intact). 2: Moderate (more defined hallucinations). 3: Severe (obviously responding to internal stimuli, poor reality testing). |
Value
A list containing:
BAWS_Score |
The calculated total score (Range 0-15). |
Severity |
Classification (Mild <3, Moderate 3-5, Severe 6-8, Very Severe >8). |
Management_Protocol |
Suggested benzodiazepine dosing based on the score. |
Next_Step |
Recommended reassessment interval. |
References
Maldonado JR, Sher Y, Das S, et al. A prospective validation study of the prediction of alcohol withdrawal severity scale (PAWSS) in medically ill inpatients: a new scale for the prediction of complicated alcohol withdrawal syndrome. Alcohol Alcohol. 2015;50(5):509-518. (Contextual reference for withdrawal scales). MDCalc. Brief Alcohol Withdrawal Scale (BAWS).
Examples
# Example 1: Moderate Withdrawal
# Tremor (1), Sweating (1), Agitated (1), Oriented (0), No Hallucinations (0)
# Score = 3
brief_alcohol_withdrawal_scale(1, 1, 1, 0, 0)
# Example 2: Severe Withdrawal
# Tremor (2), Drenching Sweat (3), Agitated (2), Disoriented time/place (2), Mild Hallucinations (1)
# Score = 10
brief_alcohol_withdrawal_scale(2, 3, 2, 2, 1)
Bristol Stool Form Scale
Description
Retrieves the description and clinical interpretation for the Bristol Stool Form Scale (BSFS). This diagnostic medical tool classifies the form of human faeces into seven categories, which correlate with colonic transit time.
Usage
bristol_stool_scale(stool_type)
Arguments
stool_type |
Numeric (1-7). The integer corresponding to the visual appearance of the stool. 1: Separate hard lumps (nuts). 2: Sausage-shaped but lumpy. 3: Sausage-shaped with cracks. 4: Sausage/snake, smooth and soft. 5: Soft blobs with clear-cut edges. 6: Fluffy pieces with ragged edges. 7: Watery, no solid pieces. |
Value
A list containing:
Type |
The input type number. |
Description |
The textual description of the stool form. |
Interpretation |
Clinical classification (e.g., Constipation, Normal, Diarrhea). |
Est_Transit_Time |
General correlation with gut transit time. |
References
Lewis SJ, Heaton KW. Stool form scale as a useful guide to intestinal transit time. Scand J Gastroenterol. 1997;32(9):920-924. doi:10.3109/00365529709011203
Examples
# Example 1: Normal Stool
bristol_stool_scale(4)
# Example 2: Severe Constipation
bristol_stool_scale(1)
# Example 3: Diarrhea
bristol_stool_scale(7)
Brief Resolved Unexplained Events 2.0 (BRUE 2.0) Criteria
Description
Applies the BRUE 2.0 criteria (based on the 2016 AAP Guidelines and subsequent validation) to risk-stratify infants presenting with a Brief Resolved Unexplained Event. The tool identifies "Lower-Risk" infants who require minimal workup versus "Higher-Risk" infants who may benefit from further observation or diagnostic testing. A BRUE is defined as a sudden, brief, resolved episode of cyanosis/pallor, absent/irregular breathing, marked tone change, or altered responsiveness in an infant < 1 year, with no explanation after history and physical exam.
Usage
brue_2_0_criteria(age_days, gestational_age_weeks, duration_less_than_1_min,
cpr_performed, recurring_event, concerning_history,
concerning_exam)
Arguments
age_days |
Numeric. Chronological age of the infant in days. |
gestational_age_weeks |
Numeric. Gestational age at birth in weeks. |
duration_less_than_1_min |
Numeric (0 or 1). Was the duration of the event < 1 minute? (1 = Yes). |
cpr_performed |
Numeric (0 or 1). Was CPR performed by a trained medical provider? (1 = Yes). |
recurring_event |
Numeric (0 or 1). Was this a recurring event (not the first episode) or part of a cluster? (1 = Yes). |
concerning_history |
Numeric (0 or 1). Are there concerning features in the history (e.g., family history of sudden death, social concerns)? (1 = Yes). |
concerning_exam |
Numeric (0 or 1). Are there concerning findings on physical examination (e.g., injury, growth failure)? (1 = Yes). |
Value
A list containing:
Classification |
"Lower-Risk BRUE", "Higher-Risk BRUE", or "Not BRUE". |
Management_Guidance |
Clinical recommendations derived from AAP 2016 guidelines. |
Risk_Factors_Present |
A list of specific criteria that placed the patient in the Higher-Risk category. |
References
Tieder JS, Bonkowsky JL, Etzel RA, et al. Clinical Practice Guideline: Brief Resolved Unexplained Events (Formerly Apparent Life-Threatening Events) and Evaluation of Lower-Risk Infants. Pediatrics. 2016;138(1):e20160590. doi:10.1542/peds.2016-0590
Examples
# Example 1: Lower-Risk BRUE
# 4-month-old (120d), term (40w), brief event, no CPR, first time, normal H&P
brue_2_0_criteria(120, 40, 1, 0, 0, 0, 0)
# Example 2: Higher-Risk BRUE (Age)
# 45-day-old, otherwise low risk
brue_2_0_criteria(45, 40, 1, 0, 0, 0, 0)
# Example 3: Higher-Risk BRUE (Duration & Recurrence)
# 3-month-old, event > 1 min, recurring
brue_2_0_criteria(90, 39, 0, 0, 1, 0, 0)
Brief Resolved Unexplained Event (BRUE) Risk Stratification
Description
Stratifies infants presenting with a Brief Resolved Unexplained Event (BRUE) into "Low Risk" or "Not Low Risk" categories based on the 2016 American Academy of Pediatrics (AAP) guidelines. Low-risk classification requires meeting rigorous age, history, and event characteristics criteria, allowing for less invasive management.
Usage
brue_risk_stratification(age_days, gestational_age_weeks,
duration_less_than_1_min, cpr_performed,
recurring_event, concerning_history_or_exam)
Arguments
age_days |
Numeric. Infant's chronological age in days. (Must be > 60 days for Low Risk). |
gestational_age_weeks |
Numeric. Gestational age at birth in weeks. (Must be >= 32 weeks for Low Risk). |
duration_less_than_1_min |
Numeric (0 or 1). Was the duration of the event < 1 minute? (1 = Yes). |
cpr_performed |
Numeric (0 or 1). Was CPR performed by a trained provider? (1 = Yes). |
recurring_event |
Numeric (0 or 1). Has more than one event occurred? (1 = Yes). |
concerning_history_or_exam |
Numeric (0 or 1). Are there concerning findings in the history (e.g., family history of sudden death) or physical exam (e.g., injury, fever)? (1 = Yes). |
Value
A list containing:
Risk_Category |
"Low Risk BRUE" or "Not Low Risk (High Risk) BRUE". |
Recommendation |
Guidance on disposition and workup. |
Criteria_Not_Met |
List of specific factors that excluded the patient from the Low Risk category. |
References
Tieder JS, Bonkowsky JL, Etzel RA, et al. Clinical Practice Guideline: Brief Resolved Unexplained Events (Formerly Apparent Life-Threatening Events) and Evaluation of Lower-Risk Infants. Pediatrics. 2016;138(1):e20160590. doi:10.1542/peds.2016-0590
Examples
# Example 1: Low Risk
# 90 days old, born at 40 weeks, short event, no CPR, first time, normal exam
brue_risk_stratification(90, 40, 1, 0, 0, 0)
# Example 2: Not Low Risk (Age)
# 45 days old (Too young), otherwise benign
brue_risk_stratification(45, 40, 1, 0, 0, 0)
# Example 3: Not Low Risk (Prematurity)
# 70 days old (Chronological OK), born at 30 weeks (GA < 32)
brue_risk_stratification(70, 30, 1, 0, 0, 0)
Brugada Criteria for Ventricular Tachycardia
Description
Implements the Brugada Algorithm to differentiate Ventricular Tachycardia (VT) from Supraventricular Tachycardia (SVT) with aberrancy in patients with wide complex tachycardia. The algorithm follows a four-step sequential evaluation. If any step is positive, the diagnosis is VT. If all steps are negative, the diagnosis defaults to SVT with aberrancy.
Usage
brugada_criteria_vt(absent_rs_precordial, rs_interval_gt_100,
av_dissociation, morphology_criteria_vt)
Arguments
absent_rs_precordial |
Numeric (0 or 1). Step 1: Is there an absence of an RS complex in ALL precordial leads? (1 = Yes -> VT). |
rs_interval_gt_100 |
Numeric (0 or 1). Step 2: Is the RS interval (onset of R to nadir of S) > 100 ms in ANY precordial lead? (1 = Yes -> VT). |
av_dissociation |
Numeric (0 or 1). Step 3: Is there AV dissociation? (1 = Yes -> VT). |
morphology_criteria_vt |
Numeric (0 or 1). Step 4: Are morphology criteria for VT present in leads V1-2 and V6? (1 = Yes -> VT). |
Value
A list containing:
Diagnosis |
"Ventricular Tachycardia (VT)" or "SVT with Aberrancy". |
Step_Positive |
The step number (1-4) that confirmed VT, or 0 if SVT. |
References
Brugada P, Brugada J, Mont L, Smeets J, Andries EW. A new approach to the differential diagnosis of a regular tachycardia with a wide QRS complex. Circulation. 1991;83(5):1649-1659. doi:10.1161/01.cir.83.5.1649
Examples
# Example 1: VT diagnosed at Step 2
# RS complex present (0), but RS interval > 100ms (1)
brugada_criteria_vt(0, 1, 0, 0)
# Example 2: SVT with Aberrancy
# All criteria negative
brugada_criteria_vt(0, 0, 0, 0)
BUN/Creatinine Ratio
Description
Calculates the Blood Urea Nitrogen (BUN) to Creatinine ratio. This ratio helps differentiate between prerenal, intrinsic renal, and postrenal causes of acute kidney injury (AKI). The calculation standardizes inputs to mg/dL before computing the ratio to ensure consistent application of the 10:1 and 20:1 clinical thresholds.
Usage
bun_creatinine_ratio(bun, creatinine, bun_units = "mg/dL", creatinine_units = "mg/dL")
Arguments
bun |
Numeric. Blood Urea Nitrogen level. |
creatinine |
Numeric. Serum Creatinine level. |
bun_units |
String. Units for BUN input. Options: "mg/dL" (default) or "mmol/L" (Urea). |
creatinine_units |
String. Units for Creatinine input. Options: "mg/dL" (default), "umol/L", or "mmol/L". |
Value
A list containing:
BUN_Creatinine_Ratio |
The calculated dimensionless ratio (based on mg/dL values). |
Interpretation |
Clinical classification (Prerenal, Normal/Postrenal, Intrarenal). |
Possible_Causes |
List of potential etiologies associated with the ratio range. |
References
Dossetor JB. Creatininemia versus uremia. The relative significance of blood urea nitrogen and serum creatinine concentrations in azotemia. Ann Intern Med. 1966;65(6):1287-1299. doi:10.7326/0003-4819-65-6-1287
Examples
# Example 1: Prerenal Azotemia (Dehydration)
# BUN 40 mg/dL, Cr 1.0 mg/dL
# Ratio = 40 (>20)
bun_creatinine_ratio(40, 1.0)
# Example 2: Intrinsic Renal Disease (ATN)
# Urea 10 mmol/L, Cr 300 umol/L
# BUN = 10 * 2.8 = 28 mg/dL
# Cr = 300 / 88.4 = 3.39 mg/dL
# Ratio = 28 / 3.39 = 8.2 (<10)
bun_creatinine_ratio(10, 300, "mmol/L", "umol/L")
Burch-Wartofsky Point Scale (BWPS) for Thyrotoxicosis
Description
Calculates the Burch-Wartofsky Point Scale score to estimate the likelihood of Thyroid Storm in patients presenting with thyrotoxicosis. The scale aggregates scores from thermoregulatory dysfunction, central nervous system effects, gastrointestinal-hepatic dysfunction, cardiovascular tachycardia, heart failure, atrial fibrillation, and the presence of a precipitating history.
Usage
burch_wartofsky_score(temp_c, cns_scale, gi_scale, heart_rate, chf_scale,
afib_present, precipitating_event)
Arguments
temp_c |
Numeric. Body temperature in degrees Celsius. 37.2-37.7: +5 pts. 37.8-38.2: +10 pts. 38.3-38.8: +15 pts. 38.9-39.3: +20 pts. 39.4-39.9: +25 pts. >= 40.0: +30 pts. |
cns_scale |
Numeric (0-3). Central Nervous System effects. 0: Absent. 1: Mild (Agitation). +10 pts. 2: Moderate (Delirium, psychosis, extreme lethargy). +20 pts. 3: Severe (Seizures, coma). +30 pts. |
gi_scale |
Numeric (0-2). Gastrointestinal-Hepatic dysfunction. 0: Absent. 1: Moderate (Diarrhea, nausea/vomiting, abdominal pain). +10 pts. 2: Severe (Unexplained jaundice). +20 pts. |
heart_rate |
Numeric. Heart rate in bpm. 99-109: +5 pts. 110-119: +10 pts. 120-129: +15 pts. 130-139: +20 pts. >= 140: +25 pts. |
chf_scale |
Numeric (0-3). Congestive Heart Failure severity. 0: Absent. 1: Mild (Pedal edema). +5 pts. 2: Moderate (Bibasilar rales). +10 pts. 3: Severe (Pulmonary edema). +15 pts. |
afib_present |
Numeric (0 or 1). Atrial Fibrillation present. (1 = Yes, +10 pts). |
precipitating_event |
Numeric (0 or 1). History of precipitating event (e.g., infection, surgery, trauma). (1 = Yes, +10 pts). |
Value
A list containing:
BWPS_Score |
The calculated total score. |
Interpretation |
Diagnostic likelihood (Unlikely < 25, Impending 25-44, Highly Suggestive >= 45). |
References
Burch HB, Wartofsky L. Life-threatening thyrotoxicosis. Thyroid storm. Endocrinol Metab Clin North Am. 1993;22(2):263-277.
Examples
# Example 1: Highly Suggestive of Storm
# Temp 39.5 (+25), Mod CNS (+20), HR 145 (+25), No GI, No CHF, No Afib, Event (+10)
# Score = 80
burch_wartofsky_score(39.5, 2, 0, 145, 0, 0, 1)
# Example 2: Impending Storm
# Temp 38.0 (+10), Mild CNS (+10), HR 115 (+10), No other signs
# Score = 30
burch_wartofsky_score(38.0, 1, 0, 115, 0, 0, 0)
Bush-Francis Catatonia Rating Scale (BFCRS)
Description
Calculates the total score for the Bush-Francis Catatonia Rating Scale, the standard instrument for diagnosing and assessing the severity of catatonia. It evaluates 23 items on a scale of 0 to 3. The first 14 items constitute the screening instrument; presence of 2 or more of these items warrants a full evaluation.
Usage
bush_francis_catatonia_scale(excitement, immobility, mutism, staring, posturing,
grimacing, echophenomena, stereotypy, mannerisms,
verbigeration, rigidity, negativism, waxy_flexibility,
withdrawal, impulsivity, automatic_obedience, mitgehen,
gegenhalten, ambitendency, grasp_reflex, perseverance,
combativeness, autonomic_abnormality)
Arguments
excitement |
Numeric (0-3). Extreme hyperactivity, constant motor unrest. |
immobility |
Numeric (0-3). Stupor, hypoactivity. |
mutism |
Numeric (0-3). Verbally unresponsive. |
staring |
Numeric (0-3). Fixed gaze, little or no blinking. |
posturing |
Numeric (0-3). Catalepsy, maintenance of posture. |
grimacing |
Numeric (0-3). Maintenance of odd facial expressions. |
echophenomena |
Numeric (0-3). Echopraxia or Echolalia. |
stereotypy |
Numeric (0-3). Repetitive, non-goal-directed movements. |
mannerisms |
Numeric (0-3). Odd, purposeful movements. |
verbigeration |
Numeric (0-3). Repetition of phrases or sentences. |
rigidity |
Numeric (0-3). Maintenance of position against resistance. |
negativism |
Numeric (0-3). Resistance to moving instructions. |
waxy_flexibility |
Numeric (0-3). Slight resistance to positioning. |
withdrawal |
Numeric (0-3). Refusal to eat/drink/interact. |
impulsivity |
Numeric (0-3). Sudden inappropriate behavior. |
automatic_obedience |
Numeric (0-3). Exaggerated cooperation. |
mitgehen |
Numeric (0-3). "Going with" body movements. |
gegenhalten |
Numeric (0-3). Resistance proportional to applied force. |
ambitendency |
Numeric (0-3). Motor indecision. |
grasp_reflex |
Numeric (0-3). Forced grasping. |
perseverance |
Numeric (0-3). Repetitive return to previous topic/movement. |
combativeness |
Numeric (0-3). Violence directed at others. |
autonomic_abnormality |
Numeric (0-3). Vital sign abnormalities. |
Value
A list containing:
BFCRS_Total_Score |
The sum of all 23 items (Range 0-69). |
Screening_Result |
"Positive Screen" if >=2 of the first 14 items are present (>0). |
Screening_Items_Present |
Count of positive screening items. |
References
Bush G, Fink M, Petrides G, Dowling F, Francis A. Catatonia. I. Rating scale and standardized examination. Acta Psychiatr Scand. 1996;93(2):129-36. doi:10.1111/j.1600-0447.1996.tb09814.x
Examples
# Example 1: Positive Screen, High Severity
# Immobility(3), Mutism(3), Staring(2), Posturing(2), Rigidity(3)
# Others 0
bush_francis_catatonia_scale(0, 3, 3, 2, 2, 0, 0, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0)
# Example 2: Negative Screen
# All 0
bush_francis_catatonia_scale(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0)
BWH Egg Freezing Counseling Tool (EFCT)
Description
Calculates the likelihood of achieving at least one, two, or three live births from elective oocyte cryopreservation (egg freezing). The model is based on data from Brigham and Women's Hospital (BWH) and accounts for the patient's age at retrieval and the number of mature oocytes frozen. It estimates the probability based on age-specific oocyte-to-blastocyst and blastocyst-to-euploidy conversion rates.
Usage
bwh_egg_freezing_tool(age, num_mature_eggs)
Arguments
age |
Numeric. The patient's age at the time of egg freezing (Valid range: 24-44 years). |
num_mature_eggs |
Numeric. The number of mature (MII) oocytes frozen. |
Value
A list containing:
Likelihood_Live_Birth |
A list of probabilities (%) for having at least 1, 2, or 3 live births. |
Model_Efficiency_Per_Egg |
The approximate probability of a single egg resulting in a live birth for the given age. |
References
Goldman RH, Racowsky C, Farland LV, et al. Predicting the likelihood of live birth for elective oocyte cryopreservation: a counseling tool for physicians and patients. Hum Reprod. 2017;32(4):853-859. doi:10.1093/humrep/dex008
Examples
# Example 1: 35-year-old with 10 eggs
# Expected: ~69% chance of at least 1 live birth
bwh_egg_freezing_tool(35, 10)
# Example 2: 40-year-old with 20 eggs
# Expected: ~51% chance of at least 1 live birth
bwh_egg_freezing_tool(40, 20)
C-Peptide-Glucose Ratio (CPGR)
Description
Calculates the C-Peptide-Glucose Ratio (CPGR), a metric used to estimate endogenous beta-cell function. This ratio helps differentiate between clinical forms of diabetes, particularly distinguishing Type 1 Diabetes (insulin deficiency) from Type 2 Diabetes or Maturity Onset Diabetes of the Young (MODY) (insulin resistance/preservation).
Usage
c_peptide_glucose_ratio(c_peptide, glucose,
c_peptide_units = "ng/mL",
glucose_units = "mg/dL")
Arguments
c_peptide |
Numeric. Fasting C-Peptide level. |
glucose |
Numeric. Fasting Plasma Glucose level. |
c_peptide_units |
String. Units for C-Peptide. Options: "ng/mL" (default), "nmol/L", or "pmol/L". |
glucose_units |
String. Units for Glucose. Options: "mg/dL" (default) or "mmol/L". |
Details
The ratio is calculated using the formula:
CPGR = \frac{C\text{-}Peptide (ng/mL)}{Glucose (mg/dL)} \times 100
While cutoffs vary by study and specific clinical question (e.g., distinguishing HNF1A-MODY from T1DM), a value of 1.7 or higher is often cited as an indicator of preserved beta-cell function indicative of T2DM or MODY.
Value
A list containing:
CPGR_Score |
The calculated ratio. |
Interpretation |
Clinical suggestion based on a standard cutoff of 1.7. |
References
Besser RE, Shields BM, anatole S, et al. Differentiation of Type 1 diabetes, Type 2 diabetes and MODY using C-peptide. Diabetes Care. 2011;34:e53.
Examples
# Example 1: Type 1 Diabetes (Low C-Peptide relative to Glucose)
# C-Pep 0.5 ng/mL, Glucose 200 mg/dL
# Ratio = (0.5 / 200) * 100 = 0.25
c_peptide_glucose_ratio(0.5, 200)
# Example 2: Type 2 Diabetes / Insulin Resistance
# C-Pep 4.0 ng/mL, Glucose 150 mg/dL
# Ratio = (4.0 / 150) * 100 = 2.67
c_peptide_glucose_ratio(4.0, 150)
CAGE Questions for Alcohol Use
Description
Calculates the score for the CAGE questionnaire, a widely used screening tool for detecting alcohol dependence and abuse. The acronym is derived from the four questions: Cut down, Annoyed, Guilty, and Eye-opener. Two or more "Yes" answers typically indicate a positive screen requiring further assessment.
Usage
cage_alcohol_screen(cut_down, annoyed, guilty, eye_opener)
Arguments
cut_down |
Numeric (0 or 1). Have you ever felt you should Cut down on your drinking? (1 = Yes). |
annoyed |
Numeric (0 or 1). Have people Annoyed you by criticizing your drinking? (1 = Yes). |
guilty |
Numeric (0 or 1). Have you ever felt bad or Guilty about your drinking? (1 = Yes). |
eye_opener |
Numeric (0 or 1). Have you ever had a drink first thing in the morning to steady your nerves or to get rid of a hangover (Eye-opener)? (1 = Yes). |
Value
A list containing:
CAGE_Score |
The calculated total score (Range 0-4). |
Screen_Result |
"Positive Screen" (Score >= 2) or "Negative Screen". |
Interpretation |
Clinical guidance regarding the likelihood of alcohol dependence. |
References
Ewing JA. Detecting alcoholism. The CAGE questionnaire. JAMA. 1984;252(14):1905-1907. doi:10.1001/jama.252.14.1905
Examples
# Example 1: Positive Screen
# Felt need to cut down (1), Annoyed by criticism (1), No guilt (0), No eye opener (0)
# Score = 2
cage_alcohol_screen(1, 1, 0, 0)
# Example 2: Negative Screen
# No affirmative answers
# Score = 0
cage_alcohol_screen(0, 0, 0, 0)
CAHP (Cardiac Arrest Hospital Prognosis) Score
Description
Calculates the CAHP score to predict neurological outcome (CPC 3-5) in patients admitted to the ICU after out-of-hospital cardiac arrest (OHCA). The score is typically used for patients treated with targeted temperature management (TTM). It stratifies patients into Low, Intermediate, and High risk for poor neurological outcome.
Usage
cahp_cardiac_arrest_score(age, location_home, initial_rhythm_shockable,
no_flow_minutes, low_flow_minutes,
epinephrine_dose_mg, arterial_ph)
Arguments
age |
Numeric. Patient age in years. |
location_home |
Numeric (0 or 1). Did the arrest occur at home? (1 = Yes, 0 = Public). |
initial_rhythm_shockable |
Numeric (0 or 1). Was the initial rhythm shockable (VF/VT)? (1 = Yes, 0 = No/PEA/Asystole). |
no_flow_minutes |
Numeric. Duration from collapse to start of CPR (No-flow interval). If unknown, >3 mins is typically assumed (High risk). |
low_flow_minutes |
Numeric. Duration from start of CPR to Return of Spontaneous Circulation (ROSC) (Low-flow interval). |
epinephrine_dose_mg |
Numeric. Total dose of epinephrine administered during resuscitation in mg. |
arterial_ph |
Numeric. Arterial pH measured on admission. |
Value
A list containing:
CAHP_Score |
The calculated prognostic score (Range 0- ~285). |
Risk_Group |
Classification (Low <150, Intermediate 150-200, High >200). |
Prob_Poor_Neuro_Outcome |
Estimated percentage risk of poor neurological outcome (CPC 3-5) at discharge/6 months. |
References
Maupain C, Bougouin W, Lamhaut L, et al. The CAHP (Cardiac Arrest Hospital Prognosis) score: a tool for risk stratification after out-of-hospital cardiac arrest. Eur Heart J. 2016;37(42):3222-3231. doi:10.1093/eurheartj/ehv556
Examples
# Example 1: Good Prognosis
# 40yo (0), Public arrest (0), Shockable (0), No flow 0 (0), Low flow 10 (0), 0 Epi (0), pH 7.4 (0)
# Score = 0
cahp_cardiac_arrest_score(40, 0, 1, 0, 10, 0, 7.4)
# Example 2: Poor Prognosis
# 80yo (53), Home (16), Asystole (27), No flow 5 (29), Low flow 40 (32), 3mg Epi (32), pH 7.1 (25)
# Score = 53 + 16 + 27 + 29 + 32 + 32 + 25 = 214
cahp_cardiac_arrest_score(80, 1, 0, 5, 40, 3, 7.1)
Calcium Correction for Hypoalbuminemia (Payne's Formula)
Description
Calculates the corrected serum calcium level in patients with hypoalbuminemia. Since approximately 40-45% of serum calcium is bound to albumin, low albumin levels can result in a falsely low total serum calcium reading despite normal ionized calcium levels. The formula adjusts the total calcium to estimate what the level would be if albumin were normal (4.0 g/dL).
Usage
calcium_correction_hypoalbuminemia(calcium, albumin,
calcium_units = "mg/dL",
albumin_units = "g/dL")
Arguments
calcium |
Numeric. The measured total serum calcium level. |
albumin |
Numeric. The measured serum albumin level. |
calcium_units |
String. Units for the calcium input. Options: "mg/dL" (default) or "mmol/L". |
albumin_units |
String. Units for the albumin input. Options: "g/dL" (default) or "g/L". |
Value
A list containing:
Corrected_Calcium_mg_dL |
The estimated corrected calcium in mg/dL. |
Corrected_Calcium_mmol_L |
The estimated corrected calcium in mmol/L. |
References
Payne RB, Little AJ, Williams RB, Milner JR. Interpretation of serum calcium in patients with abnormal serum proteins. Br Med J. 1973;4(5893):643-646. doi:10.1136/bmj.4.5893.643
Examples
# Example 1: Hypoalbuminemia masking hypercalcemia
# Calcium 10.5 mg/dL (High normal), Albumin 2.5 g/dL (Low)
# Corrected = 10.5 + 0.8 * (4.0 - 2.5) = 11.7 (Hypercalcemia)
calcium_correction_hypoalbuminemia(10.5, 2.5)
# Example 2: SI Units
# Calcium 2.2 mmol/L, Albumin 30 g/L
calcium_correction_hypoalbuminemia(2.2, 30, "mmol/L", "g/L")
Serum Anion Gap
Description
Calculates the Serum Anion Gap (AG) to evaluate metabolic acidosis. The Anion Gap represents the difference between measured cations (Sodium) and measured anions (Chloride and Bicarbonate). An optional calculation for the Albumin-Corrected Anion Gap is included, which adjusts for hypoalbuminemia, a common cause of a falsely low anion gap.
Usage
calculate_anion_gap(sodium, chloride, bicarbonate, albumin = NULL)
Arguments
sodium |
Numeric. Serum Sodium level in mEq/L or mmol/L. |
chloride |
Numeric. Serum Chloride level in mEq/L or mmol/L. |
bicarbonate |
Numeric. Serum Bicarbonate (or total CO2) level in mEq/L or mmol/L. |
albumin |
Numeric (Optional). Serum Albumin level in g/dL. Used to calculate the Corrected Anion Gap. |
Details
The basic formula is:
AG = Na - (Cl + HCO3)
The Albumin-Corrected Anion Gap formula is:
Corrected AG = AG + (2.5 \times (4.4 - Albumin))
Normal Anion Gap range is typically considered 4-12 mEq/L, though this varies by laboratory assay.
Value
A list containing:
Anion_Gap |
The calculated Anion Gap. |
Corrected_Anion_Gap |
The Anion Gap adjusted for albumin level (if albumin is provided). |
References
Emmett M, Narins RG. Clinical use of the anion gap. Medicine (Baltimore). 1977;56(1):38-54. Figge J, Jabor A, Kazda A, Fencl V. Anion gap and hypoalbuminemia. Crit Care Med. 1998;26(11):1807-1810.
Examples
calculate_anion_gap(sodium = 140, chloride = 100, bicarbonate = 24)
calculate_anion_gap(sodium = 140, chloride = 100, bicarbonate = 24, albumin = 2.5)
Expanded Disability Status Scale (EDSS) Calculator
Description
Calculates the EDSS score based on Kurtzke's Functional Systems Scores (FSS) and ambulation status. The scale ranges from 0.0 (normal) to 10.0 (death). Steps 0-4.5 are determined by FSS combinations, while steps 5.0-9.5 are defined primarily by impairment to ambulation.
Usage
calculate_edss(pyramidal, cerebellar, brainstem, sensory, bowel_bladder,
visual, cerebral, ambulation_code)
Arguments
pyramidal |
Numeric (0-6). Pyramidal function score. |
cerebellar |
Numeric (0-5). Cerebellar function score. |
brainstem |
Numeric (0-5). Brainstem function score. |
sensory |
Numeric (0-6). Sensory function score. |
bowel_bladder |
Numeric (0-6). Bowel and Bladder function score. |
visual |
Numeric (0-6). Visual function score. |
cerebral |
Numeric (0-5). Cerebral (Mental) function score. |
ambulation_code |
Numeric (0-11). Ambulation status code: 0: Unrestricted / Walks > 500m without aid. 1: Walks > 300m without aid (Step 4.5 range). 2: Walks > 200m without aid (Step 5.0 range). 3: Walks > 100m without aid (Step 5.5 range). 4: Unilateral assistance >= 100m (Step 6.0). 5: Bilateral assistance >= 20m (Step 6.5). 6: Restricted to wheelchair, can transfer/wheel self (Step 7.0). 7: Restricted to wheelchair, needs help transferring (Step 7.5). 8: Restricted to bed/chair, retains self-care (Step 8.0). 9: Restricted to bed, some effective arm use (Step 8.5). 10: Helpless bed patient, can communicate (Step 9.0). 11: Totally helpless, unable to communicate (Step 9.5). |
Value
A list containing:
EDSS_Score |
The calculated Expanded Disability Status Scale score. |
Inputs |
A record of the provided functional scores and ambulation status. |
References
Kurtzke JF. Rating neurologic impairment in multiple sclerosis: an expanded disability status scale (EDSS). Neurology. 1983;33(11):1444-1452. doi:10.1212/wnl.33.11.1444
Examples
# Example 1: Mild Disability (Ambulatory)
# Pyramidal 2, others 0/1, Walks >500m
calculate_edss(2, 1, 0, 1, 0, 0, 0, 0)
# Example 2: Moderate Disability (Walking impaired)
# Pyramidal 3, Cerebellar 2, Walks 150m without aid
# Code 3 (>100m no aid) corresponds to 5.5
calculate_edss(3, 2, 1, 0, 1, 0, 0, 3)
# Example 3: Severe Disability (Wheelchair)
# Multiple high FSS, Wheelchair restricted (can transfer)
# Code 6 -> 7.0
calculate_edss(4, 3, 2, 3, 3, 1, 1, 6)
Fractional Excretion of Sodium (FENa)
Description
Calculates the Fractional Excretion of Sodium (FENa) to help differentiate between prerenal azotemia and acute tubular necrosis (ATN) in patients with oliguric acute kidney injury.
Usage
calculate_fena(serum_sodium, serum_creatinine, urine_sodium, urine_creatinine)
Arguments
serum_sodium |
Numeric. Serum Sodium level in mEq/L or mmol/L. |
serum_creatinine |
Numeric. Serum Creatinine level in mg/dL or umol/L (must use consistent units with urine creatinine). |
urine_sodium |
Numeric. Urine Sodium level in mEq/L or mmol/L. |
urine_creatinine |
Numeric. Urine Creatinine level in mg/dL or umol/L (must use consistent units with serum creatinine). |
Value
A list containing:
FENa_Percent |
The calculated FENa percentage. |
Etiology |
Interpretation (Prerenal < 1%, Intrinsic > 2%). |
References
Espinel CH. The FeNa test. Use in the differential diagnosis of acute renal failure. JAMA. 1976;236(16):1795-1797. doi:10.1001/jama.1976.03270170035022
Examples
# Example 1: Prerenal (Dehydration)
# SNa 140, SCr 1.5, UNa 10, UCr 100
# FENa = (10 * 1.5) / (140 * 100) * 100 = 0.11%
calculate_fena(140, 1.5, 10, 100)
# Example 2: Intrinsic (ATN)
# SNa 135, SCr 2.0, UNa 40, UCr 40
# FENa = (40 * 2.0) / (135 * 40) * 100 = 1.48% (Indeterminate range, close to ATN)
calculate_fena(135, 2.0, 40, 40)
Fractional Excretion of Urea (FEUrea)
Description
Calculates the Fractional Excretion of Urea (FEUrea), a diagnostic index used to differentiate between prerenal azotemia and intrinsic acute kidney injury (specifically Acute Tubular Necrosis, ATN). FEUrea is particularly useful when the patient is on diuretics, which can alter sodium excretion and render the FENa test unreliable.
Usage
calculate_feurea(serum_urea, serum_creatinine, urine_urea, urine_creatinine,
urea_units = "mg/dL", creatinine_units = "mg/dL")
Arguments
serum_urea |
Numeric. Serum Urea level (or BUN). |
serum_creatinine |
Numeric. Serum Creatinine level. |
urine_urea |
Numeric. Urine Urea level (or Urine Urea Nitrogen). |
urine_creatinine |
Numeric. Urine Creatinine level. |
urea_units |
String. Units for the urea/BUN input. Options: "mg/dL" (Standard Urea), "BUN_mg_dL" (Blood Urea Nitrogen), or "mmol/L" (SI Units). Note: Ensure consistent units (mass vs molar) or rely on the function's internal standardization to mg/dL. The calculation is a ratio, so as long as serum and urine urea use the same units, and serum and urine creatinine use the same units, the result is valid. The function standardizes to mg/dL for consistency in handling mixed inputs. |
creatinine_units |
String. Units for creatinine input. Options: "mg/dL" (default) or "micromol/L" (or "umol/L"). |
Value
A list containing:
FEUrea_Percent |
The calculated FEUrea value as a percentage. |
Etiology |
Interpretation of the result: Prerenal (<35%), Intrinsic (>50%), or Indeterminate. |
References
Carvounis CP, Nisar S, Guro-Razuman S. Significance of the fractional excretion of urea in the differential diagnosis of acute renal failure. Kidney Int. 2002;62(6):2223-2229. doi:10.1046/j.1523-1755.2002.00683.x
Examples
# Example 1: Prerenal (on diuretics)
# Serum Urea 50 mg/dL, Serum Cr 1.5 mg/dL, Urine Urea 200 mg/dL, Urine Cr 100 mg/dL
# FEUrea = (200 * 1.5) / (50 * 100) * 100 = 6
calculate_feurea(50, 1.5, 200, 100)
# Example 2: Intrinsic (ATN)
# Serum Urea 40, Serum Cr 2.0, Urine Urea 100, Urine Cr 40
# FEUrea = (100 * 2.0) / (40 * 40) * 100 = 12.5
# (100*2)/(40*40) = 200/1600 = 0.125 * 100 = 12.5
# let's try values that give >50
# Intrinsic: U-Urea 300, U-Cr 30, S-Urea 60, S-Cr 2.0
# FEUrea = (300 * 2.0) / (60 * 30) * 100 = 600 / 1800 = 33
# Try U-Urea 600: (600*2)/(60*30) = 1200/1800 = 66
calculate_feurea(60, 2.0, 600, 30)
LDL Calculated (Friedewald Equation)
Description
Calculates Low-Density Lipoprotein (LDL) cholesterol using the Friedewald equation. This formula estimates LDL based on total cholesterol, HDL cholesterol, and triglycerides. It is the standard method for reporting LDL when direct measurement is not performed, provided triglycerides are not significantly elevated.
Usage
calculate_ldl(total_cholesterol, hdl_cholesterol, triglycerides, units = "mg/dL")
Arguments
total_cholesterol |
Numeric. Total Cholesterol level. |
hdl_cholesterol |
Numeric. High-Density Lipoprotein (HDL) Cholesterol level. |
triglycerides |
Numeric. Triglycerides level. |
units |
String. Units for all lipid inputs. Options: "mg/dL" (default) or "mmol/L". |
Details
The formula used depends on the units:
mg/dL: LDL = Total Chol - HDL - (Triglycerides / 5)
mmol/L: LDL = Total Chol - HDL - (Triglycerides / 2.2)
The equation is generally considered invalid if triglycerides exceed 400 mg/dL (4.5 mmol/L).
Value
A list containing:
LDL_Cholesterol |
The calculated LDL level. |
Validity |
A warning message if the triglyceride level exceeds the validation threshold. |
References
Friedewald WT, Levy RI, Fredrickson DS. Estimation of the concentration of low-density lipoprotein cholesterol in plasma, without use of the preparative ultracentrifuge. Clin Chem. 1972;18(6):499-502.
Examples
# Example 1: Standard Calculation (mg/dL)
# Total 200, HDL 50, Trigs 150
# LDL = 200 - 50 - (150/5) = 120
calculate_ldl(200, 50, 150)
# Example 2: High Triglycerides
# Total 250, HDL 40, Trigs 500
calculate_ldl(250, 40, 500)
Mean Arterial Pressure (MAP)
Description
Calculates the Mean Arterial Pressure (MAP), which represents the average arterial pressure during a single cardiac cycle. It is considered a better indicator of perfusion to vital organs than systolic blood pressure alone.
Usage
calculate_map(systolic_bp, diastolic_bp)
Arguments
systolic_bp |
Numeric. Systolic Blood Pressure in mmHg. |
diastolic_bp |
Numeric. Diastolic Blood Pressure in mmHg. |
Details
The formula used is:
MAP = \frac{SBP + (2 \times DBP)}{3}
Value
A list containing:
Mean_Arterial_Pressure |
The calculated MAP in mmHg. |
References
Geddes LA, Cheever E, Tacker WA, et al. The direct measurement of mean blood pressure in the canine. Cardiovasc Res Ctr Bull. 1976;15(4):99-103.
Examples
# Example 1: Normal BP
# 120/80
calculate_map(120, 80)
# Example 2: Hypotension
# 85/50
calculate_map(85, 50)
Model for End-Stage Liver Disease (MELD) / MELD-Na
Description
Calculates the MELD-Na score, used to prioritize candidates for liver transplantation and predict 3-month mortality in patients with end-stage liver disease. This function implements the 2016 OPTN/UNOS update which incorporates serum sodium for patients with an initial MELD > 11.
Usage
calculate_meld_score(bilirubin, inr, creatinine, sodium, on_dialysis = 0,
bilirubin_units = "mg/dL", creatinine_units = "mg/dL")
Arguments
bilirubin |
Numeric. Total bilirubin level. |
inr |
Numeric. International Normalized Ratio. |
creatinine |
Numeric. Serum creatinine level. |
sodium |
Numeric. Serum sodium level (mEq/L). |
on_dialysis |
Numeric (0 or 1). Has the patient had dialysis at least twice in the past week? (1 = Yes). |
bilirubin_units |
String. "mg/dL" (default) or "umol/L". |
creatinine_units |
String. "mg/dL" (default) or "umol/L". |
Value
A list containing:
MELD_Na_Score |
The calculated MELD-Na score (capped at 40). |
Est_3_Month_Mortality |
Estimated 3-month mortality based on the score range. |
References
Kamath PS, Wiesner RH, Malinchoc M, et al. A model to predict survival in patients with end-stage liver disease. Hepatology. 2001;33(2):464-470. Kim WR, Biggins SW, Kremers WK, et al. Hyponatremia and mortality among patients on the liver-transplant waiting list. N Engl J Med. 2008;359(10):1018-1026.
Examples
# Example 1: MELD-Na Adjustment Applied
# Bili 2.0, INR 1.5, Cr 1.5, Na 125 (Low Na increases score)
calculate_meld_score(2.0, 1.5, 1.5, 125, 0)
# Example 2: Standard MELD (Score <= 11)
# Bili 1.0, INR 1.0, Cr 1.0, Na 135
# Score = 6
calculate_meld_score(1.0, 1.0, 1.0, 135, 0)
Morphine Milligram Equivalents (MME) Calculator
Description
Calculates the total daily Morphine Milligram Equivalents (MME) for a patient taking one or more opioid medications. The conversion factors are based on the 2016 CDC Guidelines for Prescribing Opioids for Chronic Pain. This metric helps clinicians assess the cumulative potency of an opioid regimen to mitigate overdose risk.
Usage
calculate_mme(codeine_mg_day = 0, fentanyl_transdermal_mcg_hr = 0,
hydrocodone_mg_day = 0, hydromorphone_mg_day = 0,
methadone_mg_day = 0, morphine_mg_day = 0,
oxycodone_mg_day = 0, oxymorphone_mg_day = 0,
tapentadol_mg_day = 0, tramadol_mg_day = 0)
Arguments
codeine_mg_day |
Numeric. Total daily dose of Codeine in mg. |
fentanyl_transdermal_mcg_hr |
Numeric. Dose of transdermal Fentanyl patch in mcg/hr. |
hydrocodone_mg_day |
Numeric. Total daily dose of Hydrocodone in mg. |
hydromorphone_mg_day |
Numeric. Total daily dose of Hydromorphone in mg. |
methadone_mg_day |
Numeric. Total daily dose of Methadone in mg. (Conversion factor varies by dose). |
morphine_mg_day |
Numeric. Total daily dose of Morphine in mg. |
oxycodone_mg_day |
Numeric. Total daily dose of Oxycodone in mg. |
oxymorphone_mg_day |
Numeric. Total daily dose of Oxymorphone in mg. |
tapentadol_mg_day |
Numeric. Total daily dose of Tapentadol in mg. |
tramadol_mg_day |
Numeric. Total daily dose of Tramadol in mg. |
Value
A list containing:
Total_MME_Day |
The calculated total Morphine Milligram Equivalents per day. |
Risk_Interpretation |
Clinical guidance based on CDC risk thresholds (<50, 50-90, >=90 MME/day). |
References
Dowell D, Haegerich TM, Chou R. CDC Guideline for Prescribing Opioids for Chronic Pain — United States, 2016. MMWR Recomm Rep. 2016;65(1):1–49. doi:10.15585/mmwr.rr6501e1
Examples
# Example 1: Mixed Regimen
# 30mg Oxycodone BID (60mg/day), 10mg Methadone daily
# Oxy: 60 * 1.5 = 90. Methadone: 10 * 4 = 40. Total = 130 MME.
calculate_mme(oxycodone_mg_day = 60, methadone_mg_day = 10)
# Example 2: Fentanyl Patch
# 25 mcg/hr patch
# MME = 25 * 2.4 = 60 MME.
calculate_mme(fentanyl_transdermal_mcg_hr = 25)
Plasma Dosage Calculator
Description
Calculates the total volume of Fresh Frozen Plasma (FFP) required based on patient weight and a specified dose per kilogram. Standard dosing for reversal of coagulopathy (e.g., warfarin reversal or elevated INR) typically ranges from 10 to 15 mL/kg, though 15 mL/kg is a common starting point.
Usage
calculate_plasma_dosage(weight_kg, dose_per_kg_ml = 15)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. |
dose_per_kg_ml |
Numeric. The desired dose of plasma in mL/kg. Defaults to 15 mL/kg, which is generally recommended for INR reversal. Ranges often cited are 10-20 mL/kg. |
Details
The calculation is simply:
Total Volume (mL) = Weight (kg) \times Dose (mL/kg)
The number of units is estimated assuming an average volume of 200-250 mL per unit of FFP.
Value
A list containing:
Total_Plasma_Volume_mL |
The calculated total volume of plasma in milliliters. |
Estimated_Units_FFP |
An estimated range of FFP units required. |
References
Practice Guidelines for Blood Component Therapy: A Report by the American Society of Anesthesiologists Task Force on Blood Component Therapy. Anesthesiology. 1996;84(3):732-747. Holland LL, Brooks JP. Toward rational fresh frozen plasma transfusion: The effect of plasma transfusion on coagulation test results. Am J Clin Pathol. 2006;126(1):133-139.
Examples
# Example 1: 70kg patient, standard 15 mL/kg dose
# Volume = 70 * 15 = 1050 mL (~4-5 units)
calculate_plasma_dosage(70, 15)
# Example 2: 50kg patient, 10 mL/kg dose
# Volume = 50 * 10 = 500 mL (~2-2.5 units)
calculate_plasma_dosage(50, 10)
Pregnancy Due Dates Calculator
Description
Calculates the Estimated Due Date (EDD) and current gestational age based on various clinical inputs. The calculator supports methods using the Last Menstrual Period (LMP), Date of Conception, or IVF Transfer dates (3-day or 5-day).
Usage
calculate_pregnancy_due_date(input_date, method = "LMP", cycle_length = 28)
Arguments
input_date |
Date or String (YYYY-MM-DD). The reference date corresponding to the chosen method (e.g., the date of the LMP). |
method |
String. The method used for calculation. Options: "LMP": Last Menstrual Period (Standard Naegele's Rule). "Conception": Date of conception/ovulation. "IVF_3_Day": Date of 3-day embryo transfer. "IVF_5_Day": Date of 5-day embryo transfer. |
cycle_length |
Numeric. The length of the patient's menstrual cycle in days. Only applicable when method is "LMP". Defaults to 28. |
Value
A list containing:
Estimated_Due_Date |
The calculated date of delivery (40 weeks). |
Gestational_Age |
The current gestational age in weeks and days based on the system date. |
Current_Trimester |
The current trimester (1st, 2nd, or 3rd). |
References
American College of Obstetricians and Gynecologists. Method for Estimating Due Date. Committee Opinion No. 700. Obstet Gynecol. 2017;129(5):e150-e154.
Examples
# Example 1: Standard LMP (28 day cycle)
calculate_pregnancy_due_date("2023-01-01", "LMP")
# Example 2: Long Cycle (30 days)
calculate_pregnancy_due_date("2023-01-01", "LMP", 30)
# Example 3: IVF 5-Day Transfer
calculate_pregnancy_due_date("2023-01-15", "IVF_5_Day")
Corrected QT Interval (QTc) Calculator
Description
Calculates the Corrected QT Interval (QTc) using four standard formulas: Bazett, Fridericia, Framingham, and Hodges. The QTc adjusts the measured QT interval for heart rate, allowing for the assessment of repolarization abnormalities (e.g., Long QT Syndrome) regardless of the patient's pulse.
Usage
calculate_qtc(qt_interval_msec, heart_rate_bpm)
Arguments
qt_interval_msec |
Numeric. The measured QT interval in milliseconds (from the beginning of the Q wave to the end of the T wave). |
heart_rate_bpm |
Numeric. The patient's heart rate in beats per minute. |
Details
Formulas used:
Bazett:
QTc = QT / \sqrt{RR}(Most common, but overcorrects at high heart rates).Fridericia:
QTc = QT / \sqrt[3]{RR}.Framingham:
QTc = QT + 154 \times (1 - RR).Hodges:
QTc = QT + 1.75 \times (HR - 60).
Where RR = 60 / HR.
Value
A list containing:
QTc_Bazett |
QTc calculated via Bazett's formula. |
QTc_Fridericia |
QTc calculated via Fridericia's formula. |
QTc_Framingham |
QTc calculated via Framingham's formula. |
QTc_Hodges |
QTc calculated via Hodges' formula. |
References
Bazett HC. An analysis of the time-relations of electrocardiograms. Heart. 1920;7:353-370. Fridericia LS. Die Systolendauer im Elektrokardiogramm bei normalen Menschen und bei Herzkranken. Acta Medica Scandinavica. 1920;53:469-486.
Examples
# Example 1: Normal Heart Rate
# QT 400 ms, HR 60 bpm (RR = 1 sec)
# All formulas should yield approx 400 ms
calculate_qtc(400, 60)
# Example 2: Tachycardia
# QT 320 ms, HR 100 bpm
# Bazett overcorrects compared to others
calculate_qtc(320, 100)
Serum-Ascites Albumin Gradient (SAAG)
Description
Calculates the Serum-Ascites Albumin Gradient (SAAG) to help determine the etiology of ascites. The gradient is the difference between the serum albumin concentration and the ascites fluid albumin concentration. It distinguishes between ascites caused by portal hypertension and other causes.
Usage
calculate_saag(serum_albumin, ascites_albumin)
Arguments
serum_albumin |
Numeric. Serum Albumin level in g/dL. |
ascites_albumin |
Numeric. Ascites fluid Albumin level in g/dL. |
Value
A list containing:
SAAG_Score |
The calculated gradient (Serum - Ascites). |
Interpretation |
Diagnostic classification based on the 1.1 g/dL threshold. |
References
Runyon BA, Montano AA, Akriviadis EA, et al. The serum-ascites albumin gradient is superior to the exudate-transudate concept in the differential diagnosis of ascites. Ann Intern Med. 1992;117(3):215-220. doi:10.7326/0003-4819-117-3-215
Examples
calculate_saag(4.0, 1.2)
calculate_saag(3.2, 2.8)
Serum Osmolality/Osmolarity Calculator
Description
Calculates the estimated serum osmolality (or osmolarity) based on serum sodium, glucose, and blood urea nitrogen (BUN). Optionally includes ethanol concentration if ingestion is suspected. This calculation is useful for determining the osmolal gap when compared to measured osmolality.
Usage
calculate_serum_osmolality(sodium, glucose, bun, ethanol = 0,
glucose_units = "mg/dL", bun_units = "mg/dL",
ethanol_units = "mg/dL")
Arguments
sodium |
Numeric. Serum Sodium level in mEq/L or mmol/L. |
glucose |
Numeric. Serum Glucose level. |
bun |
Numeric. Blood Urea Nitrogen level. |
ethanol |
Numeric (Optional). Serum Ethanol level. Defaults to 0. |
glucose_units |
String. Units for glucose input. Options: "mg/dL" (default) or "mmol/L". |
bun_units |
String. Units for BUN input. Options: "mg/dL" (default) or "mmol/L". |
ethanol_units |
String. Units for ethanol input. Options: "mg/dL" (default) or "mmol/L". |
Details
The formula used (for mg/dL inputs) is:
Osmolality = (2 \times Na) + \frac{Glucose}{18} + \frac{BUN}{2.8} + \frac{Ethanol}{4.6}
If inputs are in mmol/L, the terms are simply summed (Ethanol factor may vary slightly in different literature but 4.6 divisor for mg/dL is standard).
Value
A list containing:
Calculated_Osmolality |
The estimated serum osmolality in mOsm/kg H2O. |
References
Purssell RA, Pudek M, Brubacher J, Abu-Laban RB. Derivation and validation of a formula to calculate the contribution of ethanol to the osmolal gap. Ann Emerg Med. 2001;38(6):653-659. doi:10.1067/mem.2001.119455
Examples
# Example 1: Standard Labs (mg/dL)
# Na 140, Glucose 100, BUN 15, No Ethanol
# Calc = 280 + 5.5 + 5.4 = 290.9
calculate_serum_osmolality(140, 100, 15)
# Example 2: Ethanol Intoxication
# Na 135, Glucose 90, BUN 10, Ethanol 100 mg/dL
# Calc = 270 + 5 + 3.6 + 21.7 = 300.3
calculate_serum_osmolality(135, 90, 10, 100)
Calculate Time in Target Range (TIR)
Description
Calculates the Time in Target Range (TIR) as the percentage of valid data points that fall inclusively within a specified minimum and maximum target value. This function is designed to be robust, including checks for non-numeric input and invalid range definitions.
Usage
calculate_tir(data_vector, target_min, target_max)
Arguments
data_vector |
A numeric vector of values (e.g., sensor readings, clinical measurements) to analyze. |
target_min |
A single numeric value defining the minimum boundary of the target range (inclusive). |
target_max |
A single numeric value defining the maximum boundary of the target range (inclusive). |
Details
The function enforces strict input validation:
Checks that
data_vector,target_min, andtarget_maxare numeric.Ensures
target_minis not greater thantarget_max.-
NAvalues withindata_vectorare automatically excluded from the calculation of both the numerator (in-range count) and the denominator (total count).
The TIR is calculated as: (\frac{\text{Count in Range}}{\text{Total Valid Count}}) \times 100.
Value
A numeric value between 0 and 100 representing the calculated TIR percentage. If an input error is detected, the function returns a character string containing a helpful error message.
Examples
#1. Successful Calculation
glucose_data <- c(125, 95, 150, 88, 110, 105, 78, 133, 99, 101, 140)
min_target <- 90
max_target <- 130
calculate_tir(glucose_data, min_target, max_target) # Expected: 72.72727
#2. Handling NA values (Points are 100, 110, 80, 120, 150. 3 of 5 are in range.)
na_data <- c(100, NA, 110, 80, 120, NA, 150)
calculate_tir(na_data, 90, 130) # Expected: 60
#3. Error Handling: Non-numeric data
calculate_tir(c("A", 100, 110), 90, 130)
#4. Error Handling: Invalid target range
calculate_tir(glucose_data, 130, 90)
#5. Edge Case: Empty vector
calculate_tir(numeric(0), 90, 130)
Calculate Time in Target Range using Rosendaal Interpolation
Description
Calculates the Time in Target Range (TIR) as a percentage using the Rosendaal linear interpolation method. This approach accurately accounts for the fractional time spent in range between two consecutive data points, which is the gold standard for continuous data streams like Continuous Glucose Monitoring (CGM).
Usage
calculate_tir_rosendaal(data_vector, time_interval_minutes, target_min, target_max)
Arguments
data_vector |
A numeric vector of chronologically ordered values (e.g., sensor glucose readings). Must contain at least two non-NA points for interpolation. |
time_interval_minutes |
A single positive numeric value representing the uniform time interval (in minutes) between consecutive measurements in the |
target_min |
A single numeric value defining the minimum boundary of the target range (inclusive). |
target_max |
A single numeric value defining the maximum boundary of the target range (inclusive). |
Details
The Rosendaal method estimates the time in range by assuming a linear path between two adjacent measurements (x_1 and x_2). The time spent out of range (below L or above H) is calculated using similar triangles, based on the magnitude of change (|x_2 - x_1|).
NA values are automatically omitted from data_vector before interpolation. The total observation time is based only on the intervals between valid (non-NA) points.
The core principle is:
\text{Time in Range} = \text{Interval Time} - \text{Time Out Low} - \text{Time Out High}
Value
A numeric value between 0 and 100 representing the calculated TIR percentage. If input validation fails, a character string with an error message is returned.
Examples
#Assuming data from a 5-minute CGM interval
#Calculate TIR using Rosendaal method
cgm_data <- c(150, 140, 110, 80, 95, 120, 125, 145)
interval <- 5
min_target <- 90
max_target <- 130
calculate_tir_rosendaal(cgm_data, interval, min_target, max_target)
#Example 2: Data entirely in range
in_range_data <- c(100, 110, 120, 115, 105)
calculate_tir_rosendaal(in_range_data, 10, 90, 130) # Expected: 100
#Example 3: Error handling for invalid range
cgm_data <- c(150, 140, 110, 80, 95, 120, 125, 145)
interval <- 5
min_target <- 90
max_target <- 130
calculate_tir_rosendaal(cgm_data, interval, 130, 90)
#Example 4: Error handling for insufficient data
cgm_data <- c(150, 140, 110, 80, 95, 120, 125, 145)
interval <- 5
min_target <- 90
max_target <- 130
calculate_tir_rosendaal(c(100), interval, 90, 130)
tPA (Tissue Plasminogen Activator) Dosing Calculator for Stroke
Description
Calculates the recommended dosing of Alteplase (tPA) for the treatment of acute ischemic stroke. The standard dose is 0.9 mg/kg, with a maximum total dose of 90 mg. 10% of the total dose is administered as an initial bolus over 1 minute, and the remaining 90% is infused over 60 minutes.
Usage
calculate_tpa_stroke_dosing(weight_kg)
Arguments
weight_kg |
Numeric. The patient's weight in kilograms. |
Value
A list containing:
Total_Dose_mg |
The total calculated dose (Max 90 mg). |
Bolus_Dose_mg |
The 10% bolus dose to be given over 1 minute. |
Infusion_Dose_mg |
The 90% remaining dose to be infused over 60 minutes. |
Discard_Amount_from_100mg_Vial |
The amount of medication to discard from a standard 100 mg vial to prevent overdose. |
References
The National Institute of Neurological Disorders and Stroke rt-PA Stroke Study Group. Tissue plasminogen activator for acute ischemic stroke. N Engl J Med. 1995;333(24):1581-1587. doi:10.1056/NEJM199512143332401
Examples
# Example 1: 70 kg patient
# Total = 0.9 * 70 = 63 mg
# Bolus = 6.3 mg, Infusion = 56.7 mg
calculate_tpa_stroke_dosing(70)
# Example 2: 110 kg patient (Max dose applies)
# Total = 0.9 * 110 = 99 -> Capped at 90 mg
# Bolus = 9 mg, Infusion = 81 mg
calculate_tpa_stroke_dosing(110)
Transtubular Potassium Gradient (TTKG)
Description
Calculates the Transtubular Potassium Gradient (TTKG), a semi-quantitative index of the potassium secretory process in the cortical collecting duct. It is used to distinguish between renal and extra-renal causes of potassium imbalance (hypokalemia or hyperkalemia). The calculation requires urine osmolality to be greater than serum osmolality to be valid.
Usage
calculate_ttkg(urine_potassium, serum_potassium, urine_osmolality, serum_osmolality)
Arguments
urine_potassium |
Numeric. Urine potassium concentration in mmol/L (or mEq/L). |
serum_potassium |
Numeric. Serum potassium concentration in mmol/L (or mEq/L). |
urine_osmolality |
Numeric. Urine osmolality in mOsm/kg. |
serum_osmolality |
Numeric. Serum osmolality in mOsm/kg. |
Details
The formula is:
TTKG = \frac{Urine_{K} \times Serum_{Osm}}{Serum_{K} \times Urine_{Osm}}
**Validity condition:** The formula assumes that water is reabsorbed in the medullary collecting duct, which requires Urine_{Osm} > Serum_{Osm}. If this condition is not met, the result is physiologically invalid.
Value
A list containing:
TTKG_Score |
The calculated gradient value. |
Validity |
Status indicating if the osmotic condition for calculation was met. |
Interpretation |
Clinical context based on standard thresholds (<3 or >7). |
References
Ethier JH, Kamel KS, Magner PO, Lemann J Jr, Halperin ML. The transtubular potassium concentration in patients with hypokalemia and hyperkalemia. Am J Kidney Dis. 1990;15(4):309-315. doi:10.1016/s0272-6386(12)80076-x
Examples
# Example 1: Renal K+ Wasting (Hyperaldosteronism context)
# Urine K 40, Serum K 3.0, Urine Osm 600, Serum Osm 290
# TTKG = (40 * 290) / (3.0 * 600) = 11600 / 1800 = 6.44
calculate_ttkg(40, 3.0, 600, 290)
# Example 2: Invalid Calculation (Dilute Urine)
# Urine Osm < Serum Osm
calculate_ttkg(10, 4.0, 200, 290)
Urine Anion Gap
Description
Calculates the Urine Anion Gap (UAG) to evaluate the cause of normal anion gap metabolic acidosis. The UAG serves as a surrogate for urinary ammonium (NH4+) excretion. A negative UAG implies appropriate urinary acidification (high NH4+, often due to GI bicarbonate loss), while a positive UAG suggests a renal acidification defect (low NH4+, e.g., Renal Tubular Acidosis).
Usage
calculate_urine_anion_gap(urine_sodium, urine_potassium, urine_chloride)
Arguments
urine_sodium |
Numeric. Urine Sodium concentration in mmol/L or mEq/L. |
urine_potassium |
Numeric. Urine Potassium concentration in mmol/L or mEq/L. |
urine_chloride |
Numeric. Urine Chloride concentration in mmol/L or mEq/L. |
Details
The formula is:
UAG = (U_{Na} + U_{K}) - U_{Cl}
Interpretation:
-
Negative Gap: Suggests GI bicarbonate loss (e.g., diarrhea).
-
Positive Gap: Suggests Renal Tubular Acidosis (RTA).
Value
A list containing:
Urine_Anion_Gap |
The calculated urine anion gap. |
Interpretation |
Diagnostic suggestion based on the gap polarity. |
References
Goldstein MB, Bear R, Richardson RM, et al. The urine anion gap: a clinically useful index of ammonium excretion. Am J Med Sci. 1986;292(4):198-202. doi:10.1097/00000441-198610000-00003
Examples
# Example 1: Negative Gap (GI Loss)
# Na 40, K 20, Cl 80 -> (40+20)-80 = -20
calculate_urine_anion_gap(40, 20, 80)
# Example 2: Positive Gap (RTA)
# Na 40, K 20, Cl 50 -> (40+20)-50 = 10
calculate_urine_anion_gap(40, 20, 50)
Confusion Assessment Method for the ICU (CAM-ICU)
Description
Applies the CAM-ICU algorithm to diagnose delirium in critically ill, mechanically ventilated, or non-intubated patients. The diagnosis is positive if **Feature 1 AND Feature 2 AND (Feature 3 OR Feature 4)** are present. This tool is designed to be highly sensitive and specific when used by trained staff.
Usage
cam_icu_delirium_assessment(acute_fluctuating, inattention, altered_loc,
disorganized_thinking)
Arguments
acute_fluctuating |
Numeric (0 or 1). Feature 1: Is there an acute change in mental status from baseline OR a fluctuation in the past 24 hours? (1 = Yes). |
inattention |
Numeric (0 or 1). Feature 2: Is the patient inattentive (e.g., failure on the Attention Screening Exam)? (1 = Yes). |
altered_loc |
Numeric (0 or 1). Feature 3: Is the patient's level of consciousness anything other than 0 (Alert and Calm) on the RASS? (1 = Yes). |
disorganized_thinking |
Numeric (0 or 1). Feature 4: Is there disorganized thinking (e.g., failure on the Commands/Questions set)? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Delirium Positive" or "Delirium Negative". |
Required_Features_Met |
Boolean confirmation of the three core requirements of the diagnostic algorithm. |
References
Ely EW, Margolin B, Francis J, et al. Evaluation of delirium in critically ill patients: validation of the Confusion Assessment Method for the Intensive Care Unit (CAM-ICU). Crit Care Med. 2001;29(7):1370-1379. doi:10.1097/00003246-200107000-00012
Examples
# Example 1: Delirium Positive
# Acute change (1), Inattention (1), LOC is normal (0), but Disorganized Thinking (1)
cam_icu_delirium_assessment(1, 1, 0, 1)
# Example 2: Delirium Negative (Fails F2)
# Acute change (1), Attention is normal (0), LOC altered (1), Disorganized (1)
cam_icu_delirium_assessment(1, 0, 1, 1)
Cambridge Diabetes Risk Score
Description
Calculates the Cambridge Diabetes Risk Score to estimate the probability of having undiagnosed Type 2 diabetes. This tool uses non-invasive data including age, sex, BMI, family history, smoking status, and medication history to stratify risk.
Usage
cambridge_diabetes_risk(age, sex, bmi, family_history, smoking_status,
rx_steroids_htn)
Arguments
age |
Numeric. Patient age in years. < 45: 0 points. 45-54: 6 points. 55-64: 11 points. >= 65: 13 points. |
sex |
String. Patient sex ("Male" or "Female"). (Male adds +1 point). |
bmi |
Numeric. Body Mass Index (kg/m^2). < 25: 0 points. 25-27.49: 4 points. 27.5-29.99: 9 points. >= 30: 15 points. |
family_history |
Numeric (0 or 1). History of diabetes in a parent or sibling. (1 = Yes, +5 points). |
smoking_status |
String. Smoking history. Options: "non": Never smoked (0 points). "past": Ex-smoker (2 points). "current": Current smoker (4 points). |
rx_steroids_htn |
Numeric (0 or 1). Current use of prescribed steroids or anti-hypertensive medication. (1 = Yes, +2 points). |
Value
A list containing:
Cambridge_Risk_Score |
The total calculated score. |
Interpretation |
Risk assessment based on the score threshold (Score >= 14 indicates high risk). |
References
Griffin SJ, Little PS, Hales CN, Kinmonth AL, Wareham NJ. Diabetes risk score: towards earlier detection of type 2 diabetes in general practice. Diabetes Metab Res Rev. 2000;16(3):164-171.
Examples
# Example 1: High Risk
# 60yo Male (+11+1), BMI 31 (+15), FamHx (+5), Ex-Smoker (+2), No Rx
# Score = 12 + 15 + 5 + 2 = 34
cambridge_diabetes_risk(60, "male", 31, 1, "past", 0)
# Example 2: Low Risk
# 40yo Female (0+0), BMI 24 (0), No FamHx, Non-Smoker, No Rx
# Score = 0
cambridge_diabetes_risk(40, "female", 24, 0, "non", 0)
Canadian C-Spine Rule (CCR)
Description
Implements the Canadian C-Spine Rule to determine the need for cervical spine radiography in alert and stable trauma patients. The rule proceeds through three stages: identifying high-risk factors (mandating imaging), identifying low-risk factors (allowing range of motion assessment), and assessing the ability to actively rotate the neck.
Usage
canadian_c_spine_rule(age, dangerous_mechanism, paresthesias_extremities,
simple_rear_end_mva, sitting_in_ed, ambulatory_at_any_time,
delayed_onset_neck_pain, midline_c_spine_tenderness,
able_to_rotate_45_degrees)
Arguments
age |
Numeric. Patient age in years. (>= 65 is a High Risk factor). |
dangerous_mechanism |
Numeric (0 or 1). Fall from >= 1m/5 stairs, axial load to head, high-speed MVC (>100km/h), rollover, ejection, motorized recreational vehicle, or bicycle struck/collision. (1 = Yes). |
paresthesias_extremities |
Numeric (0 or 1). Presence of paresthesias in extremities. (1 = Yes). |
simple_rear_end_mva |
Numeric (0 or 1). Simple rear-end motor vehicle collision (EXCLUDES: pushed into oncoming traffic, hit by bus/large truck, rollover, or hit by high-speed vehicle). (1 = Yes). |
sitting_in_ed |
Numeric (0 or 1). Patient is sitting in the emergency department. (1 = Yes). |
ambulatory_at_any_time |
Numeric (0 or 1). Patient has been ambulatory at any time since the injury. (1 = Yes). |
delayed_onset_neck_pain |
Numeric (0 or 1). Neck pain was not immediate (i.e., delayed onset). (1 = Yes). |
midline_c_spine_tenderness |
Numeric (0 or 1). Presence of midline cervical spine tenderness. (1 = Yes, 0 = No). Note: ABSENCE of tenderness is the low-risk factor. |
able_to_rotate_45_degrees |
Numeric (0 or 1). Patient is able to actively rotate neck 45 degrees to the left and right. (1 = Yes). |
Value
A list containing:
Recommendation |
"Radiography Indicated" or "No Radiography Needed". |
Risk_Reasoning |
The specific stage of the rule that determined the outcome (e.g., "High Risk", "Inability to Rotate Neck"). |
References
Stiell IG, Wells GA, Vandemheen KL, et al. The Canadian C-spine rule for radiography in alert and stable trauma patients. JAMA. 2001;286(15):1841-1848. doi:10.1001/jama.286.15.1841
Examples
# Example 1: High Risk (Age)
# 70yo, minor fall
canadian_c_spine_rule(70, 0, 0, 0, 1, 1, 0, 0, 1)
# Example 2: Cleared (Low Risk Factor + Rotation)
# 30yo, Simple Rear End, No midline tenderness, Can rotate
canadian_c_spine_rule(30, 0, 0, 1, 1, 1, 1, 0, 1)
# Example 3: Imaging Needed (Cannot Rotate)
# 30yo, Simple Rear End, but cannot rotate 45 degrees
canadian_c_spine_rule(30, 0, 0, 1, 1, 1, 1, 0, 0)
Canadian CT Head Rule
Description
Applies the Canadian CT Head Rule (CCHR) to determine the need for computed tomography (CT) imaging in patients with minor head injury. It stratifies patients into High Risk (requiring neurological intervention), Medium Risk (risk of brain injury on CT), and Low Risk (CT not indicated). The rule is applicable to patients with GCS 13-15 and loss of consciousness, amnesia, or confusion.
Usage
canadian_ct_head_rule(gcs_less_than_15_at_2h, suspected_open_skull_fracture,
basal_skull_fracture_signs, vomiting_ge_2, age,
amnesia_pre_impact_gt_30m, dangerous_mechanism)
Arguments
gcs_less_than_15_at_2h |
Numeric (0 or 1). Glasgow Coma Scale score < 15 at 2 hours post-injury. (1 = Yes). |
suspected_open_skull_fracture |
Numeric (0 or 1). Suspected open or depressed skull fracture. (1 = Yes). |
basal_skull_fracture_signs |
Numeric (0 or 1). Any sign of basal skull fracture (hemotympanum, raccoon eyes, CSF otorrhea/rhinorrhea, Battle's sign). (1 = Yes). |
vomiting_ge_2 |
Numeric (0 or 1). Vomiting >= 2 episodes. (1 = Yes). |
age |
Numeric. Patient age in years. (>= 65 years is High Risk). |
amnesia_pre_impact_gt_30m |
Numeric (0 or 1). Retrograde amnesia to the event > 30 minutes. (1 = Yes). |
dangerous_mechanism |
Numeric (0 or 1). Dangerous mechanism of injury (Pedestrian struck by vehicle, occupant ejected, fall from >3 ft or 5 stairs). (1 = Yes). |
Value
A list containing:
Risk_Level |
"High Risk", "Medium Risk", or "Low Risk". |
Recommendation |
"CT Head is indicated" or "CT Head not indicated". |
Reasoning |
Explanation of the risk based on intervention need or injury findings. |
References
Stiell IG, Wells GA, Vandemheen K, et al. The Canadian CT Head Rule for patients with minor head injury. Lancet. 2001;357(9266):1391-1396. doi:10.1016/s0140-6736(00)04561-x
Examples
# Example 1: High Risk (Age)
# 70yo, no other symptoms
canadian_ct_head_rule(0, 0, 0, 0, 70, 0, 0)
# Example 2: Medium Risk (Dangerous Mechanism)
# 30yo, Fall from >3ft, GCS 15
canadian_ct_head_rule(0, 0, 0, 0, 30, 0, 1)
# Example 3: Low Risk
# 25yo, Minor fall, no amnesia/vomiting
canadian_ct_head_rule(0, 0, 0, 0, 25, 0, 0)
Canadian Syncope Risk Score (CSRS)
Description
Calculates the Canadian Syncope Risk Score to predict the 30-day risk of serious adverse events in patients presenting to the Emergency Department with syncope. The score integrates clinical evaluation, ECG/lab investigations, and the final ED diagnosis.
Usage
canadian_syncope_risk_score(vasovagal_predisposition, heart_disease_history,
sbp_any, sbp_ed, troponin_elevated,
axis_qrs_qt_abnormal, ed_diagnosis_cardiac,
ed_diagnosis_vasovagal)
Arguments
vasovagal_predisposition |
Numeric (0 or 1). Clinical predispositions for vasovagal syncope (e.g., emotional distress, prolonged standing). (1 = Yes, -1 point). |
heart_disease_history |
Numeric (0 or 1). History of structural heart disease, arrhythmia, or CAD. (1 = Yes, +1 point). |
sbp_any |
Numeric (0 or 1). Was SBP < 90 or > 180 mmHg at any time during ED visit? (1 = Yes, +2 points). Note: The function argument 'sbp_ed' is kept for compatibility but logic uses 'sbp_any' as the primary flag for abnormal BP. |
sbp_ed |
Numeric. Included for flexibility, treated as redundant to sbp_any in standard scoring logic if binary flag used. |
troponin_elevated |
Numeric (0 or 1). Troponin level above 99th percentile. (1 = Yes, +2 points). |
axis_qrs_qt_abnormal |
Numeric (0 or 1). Abnormal QRS axis (<-30 or >100), duration (>130ms), or QTc (>480ms). (1 = Yes, +1 point). |
ed_diagnosis_cardiac |
Numeric (0 or 1). ED Physician diagnosis is Cardiac Syncope. (1 = Yes, +2 points). |
ed_diagnosis_vasovagal |
Numeric (0 or 1). ED Physician diagnosis is Vasovagal Syncope. (1 = Yes, -2 points). |
Value
A list containing:
CSRS_Score |
The calculated risk score (Range -3 to 11). |
Risk_Category |
Classification (Very Low, Low, Medium, High, Very High). |
Est_30_Day_Serious_Outcome_Risk |
Estimated percentage risk of serious adverse events. |
References
Thiruganasambandamoorthy V, Kwong K, Wells GA, et al. Development of the Canadian Syncope Risk Score to predict serious adverse events within 30 days of emergency department disposition. CMAJ. 2016;188(12):E289-E298. doi:10.1503/cmaj.151469
Examples
# Example 1: Very Low Risk
# Vasovagal predisposition (-1), ED Dx Vasovagal (-2)
# Score = -3
canadian_syncope_risk_score(1, 0, 0, 0, 0, 0, 0, 1)
# Example 2: High Risk
# Heart Disease (+1), Abnormal SBP (+2), Troponin (+2), Cardiac Dx (+2)
# Score = 7
canadian_syncope_risk_score(0, 1, 1, 0, 1, 0, 1, 0)
Canadian Transient Ischemic Attack (TIA) Score
Description
Calculates the Canadian TIA Score to stratify the risk of subsequent stroke within 7 days in patients presenting to the Emergency Department with a TIA. It incorporates history, clinical features, vital signs, and investigations (CT, laboratory) to categorize patients into Low, Medium, or High risk.
Usage
canadian_tia_score(history_tia_stroke, history_afib, unilateral_weakness,
speech_disturbance, duration_ge_10min, dbp_ge_110,
platelets_ge_400, glucose_ge_15, ct_findings,
carotid_stenosis_ge_50)
Arguments
history_tia_stroke |
Numeric (0 or 1). History of previous TIA or Stroke. (1 = Yes, +1 point). |
history_afib |
Numeric (0 or 1). History of Atrial Fibrillation or new AFib on ECG. (1 = Yes, +2 points). |
unilateral_weakness |
Numeric (0 or 1). Unilateral weakness. (1 = Yes, +2 points). |
speech_disturbance |
Numeric (0 or 1). Speech disturbance (aphasia or dysarthria). (1 = Yes, +2 points). |
duration_ge_10min |
Numeric (0 or 1). Duration of symptoms >= 10 minutes. (1 = Yes, +2 points). |
dbp_ge_110 |
Numeric (0 or 1). Diastolic Blood Pressure >= 110 mmHg at triage or initial assessment. (1 = Yes, +2 points). |
platelets_ge_400 |
Numeric (0 or 1). Platelet count >= 400 x 10^9/L. (1 = Yes, +2 points). |
glucose_ge_15 |
Numeric (0 or 1). Serum glucose >= 15 mmol/L (>= 270 mg/dL). (1 = Yes, +2 points). |
ct_findings |
Numeric (0, 1, or 2). Findings on initial CT Head. 0: Normal or non-specific. 1: Old infarction only (+1 point). 2: Acute infarction (with or without old infarction) (+2 points). |
carotid_stenosis_ge_50 |
Numeric (0 or 1). Carotid stenosis >= 50% on Doppler US or CTA. (1 = Yes, +2 points). |
Value
A list containing:
Canadian_TIA_Score |
The calculated score. |
Risk_Category |
"Low Risk" (Score <= 3), "Medium Risk" (Score 4-8), or "High Risk" (Score > 8). |
Subsequent_Stroke_Risk_7_Day |
Estimated probability of stroke within 7 days. |
References
Perry JJ, Sharma M, Sivilotti ML, et al. Prospective validation of the Canadian TIA Score and comparison with the ABCD2 and ABCD2-I scores. Stroke. 2014;45(6):1645-1652. doi:10.1161/STROKEAHA.114.004652
Examples
# Example 1: High Risk
# Hx Stroke (+1), AFib (+2), Weakness (+2), Duration >10m (+2), CT Acute (+2)
# Score = 9
canadian_tia_score(1, 1, 1, 0, 1, 0, 0, 0, 2, 0)
# Example 2: Low Risk
# Speech dist (+2), Duration 5 min (0), Normal CT (0), No other factors
# Score = 2
canadian_tia_score(0, 0, 0, 1, 0, 0, 0, 0, 0, 0)
Canadian Diabetes Risk Assessment Questionnaire (CANRISK)
Description
Calculates the CANRISK score to estimate the 10-year risk of developing Type 2 Diabetes or Pre-diabetes. Designed by the Public Health Agency of Canada, this tool adapts the FINDRISC model to the Canadian population by adding ethnicity and education level as risk factors.
Usage
canrisk_diabetes_score(age, sex, bmi, waist_cm, physical_activity_daily,
fruit_veg_daily, hypertension_meds, high_glucose_history,
gave_birth_large_baby, family_history, ethnicity_risk,
education_level)
Arguments
age |
Numeric. Patient age in years. <45: 0 pts. 45-54: 7 pts. 55-64: 13 pts. 65-74: 15 pts. |
sex |
String. "male" or "female". (Male adds +6 points). |
bmi |
Numeric. Body Mass Index (kg/m^2). <25: 0 pts. 25-29.9: 4 pts. 30-34.9: 9 pts. >=35: 14 pts. |
waist_cm |
Numeric. Waist circumference in cm. Male: 94-102 (+4), >102 (+6). Female: 80-88 (+4), >88 (+6). |
physical_activity_daily |
Numeric (0 or 1). Do you usually do physical activity for 30 mins daily? (1 = Yes, 0 = No). Note: No adds +2 points. |
fruit_veg_daily |
Numeric (0 or 1). Do you eat vegetables or fruits every day? (1 = Yes, 0 = No). Note: No adds +2 points. |
hypertension_meds |
Numeric (0 or 1). Have you ever taken medication for high blood pressure? (1 = Yes, +2 pts). |
high_glucose_history |
Numeric (0 or 1). Have you ever been found to have high blood sugar? (1 = Yes, +14 pts). |
gave_birth_large_baby |
Numeric (0 or 1). (Females only) Have you given birth to a baby weighing 9 lbs (4.1 kg) or more? (1 = Yes, +1 pt). |
family_history |
String. "none" (0 pts), "other_relative" (Grandparent, Aunt, Uncle, Cousin: +2 pts), "parent_sibling" (Parent, Brother, Sister, Child: +4 pts). |
ethnicity_risk |
String. "white" (0 pts), "high" (Aboriginal, African, South Asian, Hispanic: +11 pts), "east_asian" (+10 pts), "other_non_white" (+3 pts). |
education_level |
String. "university" (0 pts), "secondary" (High school diploma: +1 pt), "primary" or "less_than_high_school" (Some high school or less: +5 pts). |
Value
A list containing:
CANRISK_Score |
The calculated risk score (Range 0-~90). |
Risk_Category |
Risk classification (Low <21, Moderate 21-32, High >=33). |
References
Public Health Agency of Canada. The Canadian Diabetes Risk Questionnaire (CANRISK). Robinson CA, Agarwal G, Nylen K. Defining the risk of type 2 diabetes in the Canadian population: validation of the CANRISK.
Examples
# Example 1: Low Risk
# 40yo Female, Normal BMI/Waist, Active, Healthy Diet, White, University
canrisk_diabetes_score(40, "female", 22, 70, 1, 1, 0, 0, 0, "none", "white", "university")
# Example 2: High Risk
# 55yo Male (+13+6), BMI 31 (+9), Waist 105 (+6), No Activity (+2),
#Parent DM (+4), High Risk Eth (+11)
# Score = 13+6+9+6+2+4+11 = 51
canrisk_diabetes_score(55, "male", 31, 105, 0, 1, 0, 0, 0, "parent_sibling", "high", "university")
Caprini Score for Venous Thromboembolism (2005)
Description
Calculates the 2005 Caprini Risk Score to stratify surgical patients for risk of Venous Thromboembolism (VTE). The score aggregates weighted risk factors to determine the appropriate level of prophylaxis (mechanical vs. pharmacological).
Usage
caprini_vte_score(age, risk_factors_1pt_count, risk_factors_2pt_count,
risk_factors_3pt_count, risk_factors_5pt_count)
Arguments
age |
Numeric. Patient age in years. |
risk_factors_1pt_count |
Numeric. Count of 1-point risk factors present (excluding Age). Includes: Minor surgery, BMI > 25, Swollen legs, Varicose veins, Pregnancy/Postpartum, History of unexplained abortion, Oral contraceptives/HRT, Sepsis <1mo, Serious lung disease <1mo, Abnormal pulmonary function, Acute MI, CHF <1mo, Medical patient on bed rest, History of IBD, Prior major surgery <1mo. |
risk_factors_2pt_count |
Numeric. Count of 2-point risk factors present (excluding Age). Includes: Major open surgery (>45 min), Laparoscopic surgery (>45 min), Arthroscopic surgery, Malignancy (present or past), Confined to bed >72h, Immobilizing cast <1mo, Central venous access. |
risk_factors_3pt_count |
Numeric. Count of 3-point risk factors present (excluding Age). Includes: History of DVT/PE, Family history of thrombosis, Factor V Leiden, Prothrombin 20210A, Elevated serum homocysteine, Positive lupus anticoagulant, Elevated anticardiolipin antibodies, HIT, Other thrombophilia. |
risk_factors_5pt_count |
Numeric. Count of 5-point risk factors present. Includes: Elective major lower extremity arthroplasty, Hip/Pelvis/Leg fracture <1mo, Stroke <1mo, Multiple trauma <1mo, Acute spinal cord injury <1mo. |
Value
A list containing:
Caprini_Score |
The calculated total score. |
Risk_Category |
Risk classification (Very Low, Low, Moderate, High). |
Recommendation |
Suggested prophylaxis strategy. |
References
Caprini JA. Thrombosis risk assessment as a guide to quality patient care. Dis Mon. 2005;51(2-3):70-78. doi:10.1016/j.disamonth.2005.02.003
Examples
# Example 1: Moderate Risk
# Age 50 (1 pt), BMI > 25 (1 pt), Laparoscopic surgery > 45min (2 pts)
# Score = 1 + 1 + 2 = 4
caprini_vte_score(50, 1, 1, 0, 0)
# Example 2: High Risk
# Age 76 (3 pts), Hip Fracture (5 pts)
# Score = 3 + 5 = 8
caprini_vte_score(76, 0, 0, 0, 1)
Cardiovascular Risk in Orthotopic Liver Transplantation (CAR-OLT)
Description
Structures the inputs for the CAR-OLT risk score, a tool designed to predict the 1-year risk of major adverse cardiovascular events (MACE) following orthotopic liver transplantation. The score uses 12 pre-transplant characteristics to stratify candidates, helping to identify those who may require further cardiac testing versus those (Low Risk, score <= 23) who may proceed safely.
Usage
car_olt_score(age, sex, race, employment_status, education_level,
history_hcc, diabetes, heart_failure, atrial_fibrillation,
pulmonary_hypertension, systemic_hypertension, respiratory_failure)
Arguments
age |
Numeric. Recipient age in years. |
sex |
String. "Male" or "Female". |
race |
String. Recipient race (e.g., "White", "Black", "Other"). |
employment_status |
String. "Working" or "Not Working". |
education_level |
String. "College" or "High School or Less". |
history_hcc |
Numeric (0 or 1). History of Hepatocellular Carcinoma. (1 = Yes). |
diabetes |
Numeric (0 or 1). History of Diabetes Mellitus. (1 = Yes). |
heart_failure |
Numeric (0 or 1). History of Heart Failure. (1 = Yes). |
atrial_fibrillation |
Numeric (0 or 1). History of Atrial Fibrillation. (1 = Yes). |
pulmonary_hypertension |
Numeric (0 or 1). History of Pulmonary Hypertension. (1 = Yes). |
systemic_hypertension |
Numeric (0 or 1). History of Systemic Hypertension. (1 = Yes). |
respiratory_failure |
Numeric (0 or 1). Respiratory failure (on ventilator) at time of transplant. (1 = Yes). |
Value
A list containing:
Inputs |
The formatted list of patient risk factors. |
Risk_Threshold |
Interpretation based on the published low-risk cutoff (<= 23). |
References
VanWagner LB, Ning H, Whitsett M, et al. A point-based prediction model for cardiovascular risk in orthotopic liver transplantation: The CAR-OLT score. Hepatology. 2017;66(6):1968-1979. doi:10.1002/hep.29329
Examples
# Example: Patient structure
car_olt_score(55, "male", "white", "working", "college", 0, 1, 0, 0, 0, 1, 0)
Cardiac Anesthesia Risk Evaluation (CARE) Score
Description
Calculates the CARE score to predict in-hospital mortality and morbidity after cardiac surgery. This score categorizes patients into one of five risk classes based on the presence of specific preoperative risk factors, prioritizing the most severe condition present.
Usage
cardiac_anesthesia_risk_evaluation(history_cardiac_surgery, complex_surgery,
uncontrolled_medical_condition, emergency_surgery)
Arguments
history_cardiac_surgery |
Numeric (0 or 1). Prior cardiac surgery. (1 = Yes). This assigns a base score of 2. |
complex_surgery |
Numeric (0 or 1). Surgery other than isolated CABG (e.g., valve, aortic, or combined procedures). (1 = Yes). This assigns a base score of 3. |
uncontrolled_medical_condition |
Numeric (0 or 1). Presence of uncontrolled medical conditions (e.g., active heart failure, acute MI <7 days, unstable angina). (1 = Yes). This assigns a base score of 4. |
emergency_surgery |
Numeric (0 or 1). Surgery required immediately to save life or limb. (1 = Yes). This assigns a base score of 5. |
Details
The scoring is hierarchical. A patient is assigned the highest score for which they meet the criteria: Score 5: Emergency surgery. Score 4: Uncontrolled medical condition (if not Emergency). Score 3: Complex surgery (if not Emergency or Uncontrolled). Score 2: Prior cardiac surgery (if not the above). Score 1: Routine case (none of the above).
Value
A list containing:
CARE_Score |
The calculated risk class (1-5). |
In_Hospital_Mortality_Risk |
Estimated mortality percentage. |
Morbidity_Risk |
Estimated morbidity percentage (e.g., stroke, renal failure, prolonged ventilation). |
References
Dupuis JY, Wang F, Nathan H, et al. The cardiac anesthesia risk evaluation score: a clinically useful predictor of mortality and morbidity after cardiac surgery. Anesthesiology. 2001;94(2):194-204. doi:10.1097/00000542-200102000-00009
Examples
# Example 1: Routine CABG (No risks)
# Score = 1
cardiac_anesthesia_risk_evaluation(0, 0, 0, 0)
# Example 2: Emergency Surgery
# Regardless of other factors, Emergency = Score 5
cardiac_anesthesia_risk_evaluation(1, 1, 1, 1)
# Example 3: Valve Surgery (Complex) with no other uncontrolled conditions
# Score = 3
cardiac_anesthesia_risk_evaluation(0, 1, 0, 0)
Cardiac Power Output (CPO)
Description
Calculates Cardiac Power Output (CPO), a hemodynamic metric that integrates both pressure and flow (Cardiac Output x Mean Arterial Pressure) to assess the pumping ability of the heart. Measured in Watts, it is a potent predictor of mortality in patients with cardiogenic shock.
Usage
cardiac_power_output(mean_arterial_pressure, cardiac_output)
Arguments
mean_arterial_pressure |
Numeric. Mean Arterial Pressure (MAP) in mmHg. |
cardiac_output |
Numeric. Cardiac Output in L/min. |
Value
A list containing:
CPO_Watts |
The calculated Cardiac Power Output in Watts. |
Interpretation |
Prognostic interpretation based on the critical threshold of 0.6 Watts derived from the SHOCK trial registry. |
References
Fincke R, Hochman JS, Lowe AM, et al. Cardiac power is the strongest hemodynamic correlate of mortality in cardiogenic shock: a report from the SHOCK Trial Registry. J Am Coll Cardiol. 2004;44(2):340-348. doi:10.1016/j.jacc.2004.03.060
Examples
# Example 1: Cardiogenic Shock (Poor Prognosis)
# MAP 60 mmHg, CO 3.0 L/min
# CPO = (60 * 3.0) / 451 = 0.40 W
cardiac_power_output(60, 3.0)
# Example 2: Improved Hemodynamics
# MAP 75 mmHg, CO 4.5 L/min
# CPO = (75 * 4.5) / 451 = 0.75 W
cardiac_power_output(75, 4.5)
Cancer and Aging Research Group (CARG) Chemotherapy Toxicity Tool
Description
Calculates the CARG Toxicity Score to predict the risk of Grade 3-5 chemotherapy toxicity in older adults (age >= 65) with cancer. This tool outperforms Karnofsky Performance Status (KPS) in this population by incorporating geriatric assessment variables such as functional status, comorbidities, and social support.
Usage
carg_chemo_toxicity_score(age, sex, weight_kg, height_cm, creatinine_mg_dl,
hemoglobin_g_dl, cancer_type_gi_gu, standard_dose,
polychemotherapy, falls_last_6mo, hearing_impairment,
limit_walking_1block, assistance_meds,
limit_social_activity)
Arguments
age |
Numeric. Patient age in years. (>= 72 adds 2 points). |
sex |
String. "male" or "female". Used for Jelliffe CrCl calculation and anemia thresholds. |
weight_kg |
Numeric. Patient weight in kg (Not strictly used in simplified Jelliffe but required for general context). |
height_cm |
Numeric. Patient height in cm. |
creatinine_mg_dl |
Numeric. Serum creatinine in mg/dL. Used to calculate Creatinine Clearance via Jelliffe formula (1973). (< 34 mL/min adds 3 points). |
hemoglobin_g_dl |
Numeric. Hemoglobin in g/dL. Anemia (<11 for males, <10 for females) adds 3 points. |
cancer_type_gi_gu |
Numeric (0 or 1). Is the cancer Gastrointestinal or Genitourinary? (1 = Yes, +2 points). |
standard_dose |
Numeric (0 or 1). Is the patient receiving standard dose chemotherapy (vs. dose-reduced)? (1 = Yes, +2 points). |
polychemotherapy |
Numeric (0 or 1). Is the patient receiving more than one chemotherapy drug? (1 = Yes, +2 points). |
falls_last_6mo |
Numeric (0 or 1). Has the patient fallen in the last 6 months? (1 = Yes, +3 points). |
hearing_impairment |
Numeric (0 or 1). Is hearing "Fair" or "Worse" (or deaf)? (1 = Yes, +2 points). |
limit_walking_1block |
Numeric (0 or 1). Does the patient have any trouble walking one block? (1 = Yes, +2 points). |
assistance_meds |
Numeric (0 or 1). Does the patient need help taking medications? (1 = Yes, +1 point). |
limit_social_activity |
Numeric (0 or 1). Has physical or emotional health limited social activities? (1 = Yes, +1 point). |
Value
A list containing:
CARG_Score |
The total calculated score (Range 0-23). |
Risk_Level |
Risk stratum (Low, Intermediate, High). |
Grade_3_5_Toxicity_Risk |
Estimated percentage probability of severe toxicity. |
Calculated_Jelliffe_CrCl |
The calculated CrCl value used in scoring. |
References
Hurria A, Togawa K, Mohile SG, et al. Predicting chemotherapy toxicity in older adults with cancer: a prospective multicenter study. J Clin Oncol. 2011;29(25):3457-3465. doi:10.1200/JCO.2011.34.7625
Examples
# Example 1: High Risk
# 75yo Male, GI Cancer, Standard Dose, Anemic, Fall Hx
# Score calculation depends on CrCl and other factors
carg_chemo_toxicity_score(75, "male", 70, 175, 1.2, 10.0, 1, 1, 0, 1, 0, 0, 0, 0)
# Example 2: Low Risk
# 66yo Female, Breast Cancer (Other), Reduced Dose, No functional deficits
carg_chemo_toxicity_score(66, "female", 60, 160, 0.8, 12.0, 0, 0, 1, 0, 0, 0, 0, 0)
CAROC System for Fracture Risk Assessment
Description
Calculates the 10-year risk of major osteoporotic fracture using the 2010 Canadian Association of Radiologists and Osteoporosis Canada (CAROC) system. This tool stratifies patients into Low, Moderate, or High risk categories based on Age, Sex, Femoral Neck T-score, Prior Fragility Fracture, and Glucocorticoid use.
Usage
caroc_fracture_risk(sex, age, femoral_neck_t_score,
prior_fragility_fracture, glucocorticoid_use)
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age |
Numeric. Patient age in years (Valid for age >= 50). |
femoral_neck_t_score |
Numeric. Bone Mineral Density (BMD) T-score at the femoral neck. |
prior_fragility_fracture |
Numeric (0 or 1). History of fragility fracture after age 40. (1 = Yes). Note: Presence increases risk by one category. |
glucocorticoid_use |
Numeric (0 or 1). Recent prolonged use of systemic glucocorticoids (e.g., >3 months). (1 = Yes). Note: Presence increases risk by one category. |
Value
A list containing:
Risk_Category |
The calculated risk zone (Low, Moderate, High). |
Ten_Year_Fracture_Risk |
The estimated percentage risk of major osteoporotic fracture over 10 years. |
References
Papaioannou A, Morin S, Cheung AM, et al. 2010 clinical practice guidelines for the diagnosis and management of osteoporosis in Canada: summary. CMAJ. 2010;182(17):1864-1873. doi:10.1503/cmaj.100771
Examples
# Example 1: Moderate Risk bumped to High
# 65yo Female, T-score -2.0 (Moderate Base), Prior Fracture (+1 Category)
caroc_fracture_risk("female", 65, -2.0, 1, 0)
# Example 2: Low Risk
# 55yo Male, T-score -1.0, No risk factors
caroc_fracture_risk("male", 55, -1.0, 0, 0)
Cardiac Arrest Risk Triage (CART) Score
Description
Calculates the CART score, a physiological track-and-trigger system designed to predict cardiac arrest in hospitalized patients. Unlike other early warning scores that rely on subjective assessments (like "AVPU"), CART uses weighted points for four objective vital sign and demographic variables (Respiratory Rate, Heart Rate, Diastolic BP, and Age) to identify patients at risk of deterioration.
Usage
cart_cardiac_arrest_score(respiratory_rate, heart_rate, diastolic_bp, age)
Arguments
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. < 21: 0 pts. 21-23: 8 pts. 24-25: 12 pts. 26-29: 15 pts. > 29: 22 pts. |
heart_rate |
Numeric. Heart rate in beats per minute. < 110: 0 pts. 110-139: 4 pts. > 139: 13 pts. |
diastolic_bp |
Numeric. Diastolic blood pressure in mmHg. > 49: 0 pts. 40-49: 4 pts. 35-39: 6 pts. < 35: 13 pts. |
age |
Numeric. Patient age in years. < 55: 0 pts. 55-69: 4 pts. > 69: 9 pts. |
Value
A list containing:
CART_Score |
The calculated risk score (Range 0-57). Higher scores indicate a significantly higher risk of cardiac arrest or ICU transfer. |
References
Churpek MM, Yuen TC, Park SY, et al. Derivation of a cardiac arrest prediction model using ward vital signs. Crit Care Med. 2012;40(7):2102-2108. doi:10.1097/CCM.0b013e318250aa5a
Examples
# Example 1: High Risk
# RR 30 (+22), HR 145 (+13), DBP 30 (+13), Age 75 (+9)
# Score = 57
cart_cardiac_arrest_score(30, 145, 30, 75)
# Example 2: Moderate Risk
# RR 22 (+8), HR 100 (0), DBP 60 (0), Age 60 (+4)
# Score = 12
cart_cardiac_arrest_score(22, 100, 60, 60)
CASPAR Criteria for Psoriatic Arthritis
Description
Calculates the CASPAR (ClASsification criteria for Psoriatic ARthritis) score. These criteria are intended for patients with inflammatory articular disease (joint, spine, or entheseal). A score of 3 or greater has high sensitivity (91.4%) and specificity (98.7%) for the diagnosis of Psoriatic Arthritis.
Usage
caspar_psoriatic_arthritis(inflammatory_disease_present, current_psoriasis,
personal_history_psoriasis, family_history_psoriasis,
nail_dystrophy, negative_rf, dactylitis,
juxta_articular_bone_formation)
Arguments
inflammatory_disease_present |
Numeric (0 or 1). Entry Criterion: Does the patient have inflammatory articular disease (joint, spine, or entheseal)? (1 = Yes). |
current_psoriasis |
Numeric (0 or 1). Current psoriatic skin or scalp disease present as judged by a rheumatologist or dermatologist. (1 = Yes, +2 points). |
personal_history_psoriasis |
Numeric (0 or 1). A history of psoriasis that may be obtained from patient, family physician, dermatologist, rheumatologist, or other qualified health care provider. (1 = Yes, +1 point). Note: Only scored if Current Psoriasis is No. |
family_history_psoriasis |
Numeric (0 or 1). A history of psoriasis in a first- or second-degree relative according to patient report. (1 = Yes, +1 point). Note: Only scored if Current and Personal History are No. |
nail_dystrophy |
Numeric (0 or 1). Typical psoriatic nail dystrophy including onycholysis, pitting, and hyperkeratosis observed on current physical examination. (1 = Yes, +1 point). |
negative_rf |
Numeric (0 or 1). A negative test for rheumatoid factor by any method except latex but preferably by ELISA or nephelometry. (1 = Yes, +1 point). |
dactylitis |
Numeric (0 or 1). Swelling of an entire digit (dactylitis); present or recorded by a rheumatologist. (1 = Yes, +1 point). |
juxta_articular_bone_formation |
Numeric (0 or 1). Ill-defined ossification near joint margins (excluding osteophyte formation) on plain radiographs of hand or foot. (1 = Yes, +1 point). |
Value
A list containing:
Total_Score |
The calculated CASPAR score (Range 0-6). |
Classification |
"Classified as Psoriatic Arthritis" if Score >= 3, otherwise "Not Classified". |
References
Taylor W, Gladman D, Helliwell P, et al. Classification criteria for psoriatic arthritis: development of new criteria from a large international study. Arthritis Rheum. 2006;54(8):2665-2673. doi:10.1002/art.21972
Examples
# Example 1: Classified as PsA
# Inflammatory disease present, Current Psoriasis (+2), Nail Dystrophy (+1)
# Score = 3
caspar_psoriatic_arthritis(1, 1, 0, 0, 1, 0, 0, 0)
# Example 2: Not Classified
# Inflammatory disease present, Family Hx (+1), Negative RF (+1)
# Score = 2
caspar_psoriatic_arthritis(1, 0, 0, 1, 0, 1, 0, 0)
CATCH Rule (Canadian Assessment of Tomography for Childhood Head Injury)
Description
Applies the CATCH Rule to determine the need for CT imaging in children with minor head injury. The rule stratifies patients into High Risk (need for neurological intervention) and Medium Risk (potential brain injury on CT).
Usage
catch_head_injury_rule(gcs_lt_15_2hr, suspected_open_skull_fx, worsening_headache,
irritability, basal_skull_fx_signs, large_boggy_hematoma,
dangerous_mechanism)
Arguments
gcs_lt_15_2hr |
Numeric (0 or 1). GCS < 15 at 2 hours after injury. (High Risk Factor). |
suspected_open_skull_fx |
Numeric (0 or 1). Suspected open or depressed skull fracture. (High Risk Factor). |
worsening_headache |
Numeric (0 or 1). History of worsening headache. (High Risk Factor). |
irritability |
Numeric (0 or 1). Irritability on examination. (High Risk Factor). |
basal_skull_fx_signs |
Numeric (0 or 1). Any sign of basal skull fracture (e.g., raccoon eyes, Battle's sign, hemotympanum, otorrhea/rhinorrhea). (Medium Risk Factor). |
large_boggy_hematoma |
Numeric (0 or 1). Large, boggy hematoma of the scalp. (Medium Risk Factor). |
dangerous_mechanism |
Numeric (0 or 1). Dangerous mechanism of injury (e.g., MVA, fall from height >3ft or 5 stairs, bicycle w/o helmet). (Medium Risk Factor). |
Value
A list containing:
Risk_Level |
"High Risk", "Medium Risk", or "Low Risk". |
Recommendation |
Clinical guidance on CT imaging necessity. |
References
Osmond MH, Klassen TP, Wells GA, et al. CATCH: a clinical decision rule for the use of computed tomography in children with minor head injury. CMAJ. 2010;182(4):341-348. doi:10.1503/cmaj.091423
Examples
# Example 1: High Risk
# GCS 14 at 2h (+1), Irritable (+1)
catch_head_injury_rule(1, 0, 0, 1, 0, 0, 0)
# Example 2: Medium Risk
# Normal GCS, but Dangerous Mechanism (Fall >3ft)
catch_head_injury_rule(0, 0, 0, 0, 0, 0, 1)
# Example 3: Low Risk
# No risk factors
catch_head_injury_rule(0, 0, 0, 0, 0, 0, 0)
Corrected Count Increment (CCI) for Platelet Transfusion
Description
Calculates the Corrected Count Increment (CCI) to evaluate the efficacy of platelet transfusions. This metric adjusts the observed rise in platelet count for the patient's body surface area and the dose of platelets administered. It is the standard method for diagnosing platelet refractoriness.
Usage
cci_platelet_transfusion(post_platelet_count, pre_platelet_count, bsa,
platelets_transfused_10_11)
Arguments
post_platelet_count |
Numeric. Platelet count measured 10-60 minutes after transfusion (cells/uL or /mm3). |
pre_platelet_count |
Numeric. Platelet count measured prior to transfusion (cells/uL or /mm3). |
bsa |
Numeric. Patient's Body Surface Area in m^2. |
platelets_transfused_10_11 |
Numeric. The number of platelets transfused in units of 10^11. (e.g., for 3.0 x 10^11 platelets, enter 3.0). A typical apheresis unit contains ~3.0-4.0 x 10^11 platelets. A pooled random donor unit contains ~0.5-0.8 x 10^11 per unit. |
Value
A list containing:
CCI_Value |
The calculated Corrected Count Increment. |
Interpretation |
Clinical interpretation regarding refractoriness (typically defined as CCI < 7500 at 1 hour). |
References
Hod E, Schwartz J. Platelet transfusion refractoriness. Br J Haematol. 2008;142(3):348-360. doi:10.1111/j.1365-2141.2008.07189.x
Examples
# Example 1: Successful Transfusion
# Post 40k, Pre 10k, BSA 1.8, Transfused 3.0 x 10^11
# CCI = ((40000 - 10000) * 1.8) / 3.0 = 18000
cci_platelet_transfusion(40000, 10000, 1.8, 3.0)
# Example 2: Refractory
# Post 12k, Pre 10k, BSA 2.0, Transfused 3.0 x 10^11
# CCI = ((12000 - 10000) * 2.0) / 3.0 = 1333
cci_platelet_transfusion(12000, 10000, 2.0, 3.0)
Canadian Cardiovascular Society (CCS) Angina Grade
Description
Determines the Canadian Cardiovascular Society (CCS) grading of angina pectoris. This standard classification system grades the severity of exertional angina based on the threshold of physical activity at which symptoms occur, ranging from Grade I (least severe) to Grade IV (most severe).
Usage
ccs_angina_grade(inability_or_rest, marked_limitation, slight_limitation,
strenuous_only)
Arguments
inability_or_rest |
Numeric (0 or 1). Grade IV Criterion: Inability to carry on any physical activity without discomfort, OR angina syndrome is present at rest. (1 = Yes). |
marked_limitation |
Numeric (0 or 1). Grade III Criterion: Marked limitation of ordinary physical activity. Angina occurs on walking 1-2 blocks on the level and climbing 1 flight of stairs in normal conditions and at a normal pace. (1 = Yes). |
slight_limitation |
Numeric (0 or 1). Grade II Criterion: Slight limitation of ordinary activity. Angina occurs on walking >2 blocks on the level and climbing >1 flight of stairs in normal conditions and at a normal pace. (1 = Yes). |
strenuous_only |
Numeric (0 or 1). Grade I Criterion: Ordinary physical activity (walking, climbing stairs) does not cause angina. Angina occurs with strenuous, rapid, or prolonged exertion. (1 = Yes). |
Value
A list containing:
CCS_Grade |
The calculated CCS Grade (I, II, III, or IV). |
Description |
The clinical definition associated with the assigned grade. |
References
Campeau L. Grading of angina pectoris. Circulation. 1976;54(3):522-523. doi:10.1161/01.cir.54.3.522
Examples
# Example 1: Severe Angina
# Patient has angina at rest
ccs_angina_grade(1, 0, 0, 0)
# Example 2: Moderate Angina
# Patient can walk 1-2 blocks but has marked limitation
ccs_angina_grade(0, 1, 0, 0)
Clinical Disease Activity Index (CDAI) for Rheumatoid Arthritis
Description
Calculates the CDAI score to assess disease activity in patients with Rheumatoid Arthritis. Unlike the DAS28, the CDAI does not require laboratory results (ESR or CRP), allowing for immediate calculation during a clinical visit. It is the simple sum of the tender joint count (28 joints), swollen joint count (28 joints), and patient and provider global assessments (0-10 scale).
Usage
cdai_rheumatoid_arthritis(tender_joint_count, swollen_joint_count,
patient_global_assessment, provider_global_assessment)
Arguments
tender_joint_count |
Numeric (0-28). Number of tender joints upon examination. |
swollen_joint_count |
Numeric (0-28). Number of swollen joints upon examination. |
patient_global_assessment |
Numeric (0-10). Patient's Global Assessment of disease activity on a visual analog scale (0 = best, 10 = worst). |
provider_global_assessment |
Numeric (0-10). Provider's Global Assessment of disease activity on a visual analog scale (0 = best, 10 = worst). |
Value
A list containing:
CDAI_Score |
The calculated score (Range 0-76). |
Disease_Activity |
Classification based on the score: Remission (<= 2.8), Low (> 2.8 - 10.0), Moderate (> 10.0 - 22.0), High (> 22.0). |
References
Aletaha D, Smolen J. The Simplified Disease Activity Index (SDAI) and the Clinical Disease Activity Index (CDAI): a review of their usefulness and validity in rheumatoid arthritis. Clin Exp Rheumatol. 2005;23(5 Suppl 39):S100-8.
Examples
# Example 1: High Activity
# 8 tender, 6 swollen, Pt Global 7, Prov Global 6
# Score = 8 + 6 + 7 + 6 = 27
cdai_rheumatoid_arthritis(8, 6, 7, 6)
# Example 2: Remission
# 0 tender, 0 swollen, Pt Global 1, Prov Global 0.5
# Score = 1.5
cdai_rheumatoid_arthritis(0, 0, 1, 0.5)
Crohn's Disease Activity Index (CDAI)
Description
Calculates the Crohn's Disease Activity Index (CDAI), the gold standard for assessing disease severity in clinical studies of Crohn's disease. The score is based on 8 weighted factors collected over a 7-day period, including stool frequency, pain, general well-being, and specific laboratory/clinical findings.
Usage
cdai_score(liquid_stools_sum_7d, abdominal_pain_sum_7d, well_being_sum_7d,
complications_count, antidiarrheal_use, abdominal_mass,
hematocrit, weight_kg, standard_weight_kg, sex)
Arguments
liquid_stools_sum_7d |
Numeric. Sum of the number of liquid or soft stools for each of the last 7 days. |
abdominal_pain_sum_7d |
Numeric. Sum of daily abdominal pain ratings for the last 7 days (0=None, 1=Mild, 2=Moderate, 3=Severe). |
well_being_sum_7d |
Numeric. Sum of daily general well-being ratings for the last 7 days (0=Generally well, 1=Slightly under par, 2=Poor, 3=Very poor, 4=Terrible). |
complications_count |
Numeric. Count of extra-intestinal complications present (e.g., Arthritis, Iritis, Erythema nodosum, Pyoderma gangrenosum, Anal fissure/fistula, Other fistula, Fever >37.8C). |
antidiarrheal_use |
Numeric (0 or 1). Use of antidiarrheal drugs (e.g., loperamide) for diarrhea. (1 = Yes). |
abdominal_mass |
Numeric (0, 2, or 5). Physical exam finding. 0 = None, 2 = Questionable, 5 = Definite. |
hematocrit |
Numeric. Current Hematocrit (%). The score adds 6 points per percent deviation from standard (Male: 47, Female: 42). |
weight_kg |
Numeric. Current body weight in kg. |
standard_weight_kg |
Numeric. Standard body weight for height/sex in kg. |
sex |
String. "male" or "female". Used for Hematocrit standardization. |
Value
A list containing:
CDAI_Score |
The calculated total score (Range 0 to >600). |
Disease_Activity |
Classification (Remission <150, Mild 150-219, Moderate 220-450, Severe >450). |
References
Best WR, Becktel JM, Singleton JW, Kern F Jr. Development of a Crohn's disease activity index. National Cooperative Crohn's Disease Study. Gastroenterology. 1976;70(3):439-444.
Examples
# Example 1: Moderate Disease
# 20 stools total (7 days), Pain sum 10, Well-being sum 10, 1 Complication,
# Antidiarrheals yes, No mass, Hct 40 (Male -> 47-40=7), Weight 70 (Std 75 -> ~6.7% dev)
# Score = (20*2) + (10*5) + (10*7) + (1*20) + 30 + 0 + (7*6) + 6.7 = ~268.7
cdai_score(20, 10, 10, 1, 1, 0, 40, 70, 75, "male")
# Example 2: Remission
# 7 stools total, Pain sum 0, Well-being sum 0, No complications, No meds,
# No mass, Hct 42 (Female -> 0), Weight 60 (Std 60 -> 0)
# Score = 14 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 14
cdai_score(7, 0, 0, 0, 0, 0, 42, 60, 60, "female")
CEDOCS Score for Emergency Department Overcrowding
Description
Calculates the Community Emergency Department Overcrowding Scale (CEDOCS) score. This tool estimates the severity of overcrowding in community emergency departments (EDs) using operational variables such as patient census, waiting times, and annual volume. It is derived from the NEDOCS tool but calibrated for community hospital settings.
Usage
cedocs_score(critical_care_patients, longest_admit_wait_hours,
waiting_room_patients, total_ed_patients, ed_beds, annual_visits)
Arguments
critical_care_patients |
Numeric. Number of critical care patients currently in the ED. |
longest_admit_wait_hours |
Numeric. The longest time (in hours) any currently admitted patient has been waiting in the ED for a hospital bed. |
waiting_room_patients |
Numeric. Number of patients currently in the ED waiting room. |
total_ed_patients |
Numeric. Total number of patients currently in the ED (including those in beds, hallways, and waiting room). |
ed_beds |
Numeric. Total licensed number of ED treatment beds. |
annual_visits |
Numeric. The total number of ED visits per year (annual census). |
Value
A list containing:
CEDOCS_Score |
The calculated score (Range 0-200). |
Level_of_Crowding |
Interpretation of the score: 0-20: Not Busy 21-60: Busy 61-100: Extremely Busy but Not Overcrowded 101-140: Overcrowded 141-180: Severely Overcrowded 181-200: Dangerously Overcrowded |
References
Weiss SJ, Derlet R, Arndahl J, et al. Estimating the degree of emergency department overcrowding in academic medical centers: results of the National ED Overcrowding Study (NEDOCS). Acad Emerg Med. 2004;11(1):38-50. Weiss SJ, Ernst AA, Nick TG. Identifying and comparing the crowds in emergency departments.
Examples
# Example 1: Busy ED
# 2 critical, 4 hour wait, 10 in waiting room, 25 total patients, 20 beds, 35k visits
cedocs_score(2, 4, 10, 25, 20, 35000)
# Example 2: Overcrowded ED
# 5 critical, 8 hour wait, 25 in waiting room, 50 total patients, 30 beds, 50k visits
cedocs_score(5, 8, 25, 50, 30, 50000)
Centor Score (Modified/McIsaac) for Strep Pharyngitis
Description
Calculates the Modified Centor (McIsaac) Score to estimate the probability that pharyngitis is caused by Group A Beta-hemolytic Streptococcus (GAS) and to guide testing and antibiotic therapy. This modification adjusts the original Centor criteria for patient age.
Usage
centor_score_modified(age, tonsillar_exudate, tender_anterior_cervical_adenopathy,
fever_history, absence_of_cough)
Arguments
age |
Numeric. Patient age in years. 3-14 years: +1 point. 15-44 years: 0 points. >= 45 years: -1 point. |
tonsillar_exudate |
Numeric (0 or 1). Presence of tonsillar swelling or exudate. (1 = Yes, +1 point). |
tender_anterior_cervical_adenopathy |
Numeric (0 or 1). Presence of tender anterior cervical lymphadenopathy. (1 = Yes, +1 point). |
fever_history |
Numeric (0 or 1). History of fever (> 38 C / 100.4 F). (1 = Yes, +1 point). |
absence_of_cough |
Numeric (0 or 1). Absence of cough. (1 = Yes/Absent, +1 point). |
Value
A list containing:
Centor_Score |
The calculated score (Range -1 to 5). |
Strep_Probability |
Estimated risk of streptococcal infection. |
Management_Guideline |
Recommendations regarding Rapid Antigen Detection Testing (RADT), culture, and antibiotics. |
References
McIsaac WJ, Kellner JD,ont P, Esmail A, et al. Empirical validation of guidelines for the management of pharyngitis in children and adults. JAMA. 2004;291(13):1587-1595. doi:10.1001/jama.291.13.1587
Centor RM, Witherspoon JM, Dalton HP, Brody CE, Link K. The diagnosis of strep throat in adults in the emergency room. Med Decis Making. 1981;1(3):239-246. doi:10.1177/0272989x8100100304
Examples
# Example 1: High Risk Child
# 10yo (+1), Exudate (+1), Nodes (+1), No Fever (0), No Cough (+1)
# Score = 4
centor_score_modified(10, 1, 1, 0, 1)
# Example 2: Low Risk Adult
# 50yo (-1), No Exudate, No Nodes, Fever (+1), Cough present (0)
# Score = 0
centor_score_modified(50, 0, 0, 1, 0)
Cerebral Perfusion Pressure (CPP)
Description
Calculates Cerebral Perfusion Pressure (CPP), defined as the net pressure gradient causing cerebral blood flow to the brain. It is calculated by subtracting the Intracranial Pressure (ICP) from the Mean Arterial Pressure (MAP). Maintenance of adequate CPP is critical in the management of Traumatic Brain Injury (TBI) to prevent ischemia.
Usage
cerebral_perfusion_pressure(mean_arterial_pressure, intracranial_pressure)
Arguments
mean_arterial_pressure |
Numeric. The Mean Arterial Pressure (MAP) in mmHg. |
intracranial_pressure |
Numeric. The Intracranial Pressure (ICP) in mmHg. |
Value
A list containing:
CPP_mmHg |
The calculated Cerebral Perfusion Pressure. |
Interpretation |
Clinical context based on Brain Trauma Foundation guidelines (Target 60-70 mmHg). |
References
Carney N, Totten AM, O'Reilly C, et al. Guidelines for the Management of Severe Traumatic Brain Injury, Fourth Edition. Neurosurgery. 2017;80(1):6-15. doi:10.1227/NEU.0000000000001432
Examples
# Example 1: Normal Target
# MAP 85, ICP 15
# CPP = 70 mmHg
cerebral_perfusion_pressure(85, 15)
# Example 2: Ischemic Risk
# MAP 60, ICP 25
# CPP = 35 mmHg
cerebral_perfusion_pressure(60, 25)
CHA2DS2-VA Score for Atrial Fibrillation Stroke Risk
Description
Calculates the CHA2DS2-VA score to estimate stroke risk in patients with non-valvular atrial fibrillation. This score is a modification of the CHA2DS2-VASc score that excludes the sex category ("Sc"), addressing potential overestimation of risk in females and providing a uniform anticoagulation threshold.
Usage
cha2ds2_va_score(age, chf_history, hypertension, diabetes,
stroke_tia_thromboembolism, vascular_disease)
Arguments
age |
Numeric. Patient age in years. (>= 75: +2 points, 65-74: +1 point, < 65: 0 points). |
chf_history |
Numeric (0 or 1). Congestive Heart Failure history. (1 = Yes, +1 point). |
hypertension |
Numeric (0 or 1). History of Hypertension. (1 = Yes, +1 point). |
diabetes |
Numeric (0 or 1). History of Diabetes Mellitus. (1 = Yes, +1 point). |
stroke_tia_thromboembolism |
Numeric (0 or 1). History of Stroke, TIA, or Thromboembolism. (1 = Yes, +2 points). |
vascular_disease |
Numeric (0 or 1). History of Vascular Disease (e.g., prior MI, PAD, aortic plaque). (1 = Yes, +1 point). |
Value
A list containing:
CHA2DS2_VA_Score |
The calculated score (Range 0-8). |
Risk_Category |
Risk classification (Low, Intermediate, High). |
Annual_Stroke_Risk_No_Anticoagulation |
Estimated annual stroke risk percentage without anticoagulation. |
Recommendation |
Clinical guidance regarding anticoagulation therapy. |
References
Nielsen PB, Skjøth F, Overvad TF, Larsen TB, Lip GY. Female Sex Is a Risk Modifier Rather Than a Risk Factor for Stroke in Atrial Fibrillation: Should We Use a CHA2DS2-VA Score? Circulation. 2018;137(8):832-840. doi:10.1161/CIRCULATIONAHA.117.029081
Examples
# Example 1: Moderate Risk (Score 2)
# 68yo (+1), Hypertension (+1), No other factors
cha2ds2_va_score(68, 0, 1, 0, 0, 0)
# Example 2: High Risk (Score 5)
# 76yo (+2), Diabetes (+1), Prior Stroke (+2)
cha2ds2_va_score(76, 0, 0, 1, 1, 0)
CHA2DS2-VASc Score for Atrial Fibrillation Stroke Risk
Description
Calculates the CHA2DS2-VASc score to estimate the risk of stroke in patients with non-valvular atrial fibrillation. This score refines the older CHADS2 score by extending the risk factors to include age 65-74, vascular disease, and female sex. It is widely used to determine the indication for oral anticoagulation therapy.
Usage
cha2ds2_vasc_score(age, sex, chf_history, hypertension_history,
stroke_tia_history, vascular_disease_history, diabetes_history)
Arguments
age |
Numeric. Patient age in years. (65-74: +1 point; >=75: +2 points). |
sex |
String. Patient sex ("Male" or "Female"). (Female: +1 point). |
chf_history |
Numeric (0 or 1). Congestive heart failure history. (1 = Yes, +1 point). |
hypertension_history |
Numeric (0 or 1). Hypertension history. (1 = Yes, +1 point). |
stroke_tia_history |
Numeric (0 or 1). History of Stroke, TIA, or Thromboembolism. (1 = Yes, +2 points). |
vascular_disease_history |
Numeric (0 or 1). Vascular disease history (prior MI, peripheral artery disease, or aortic plaque). (1 = Yes, +1 point). |
diabetes_history |
Numeric (0 or 1). Diabetes mellitus history. (1 = Yes, +1 point). |
Value
A list containing:
CHA2DS2_VASc_Score |
The calculated score (Range 0-9). |
Annual_Stroke_Risk_No_Anticoagulation |
Estimated annual stroke risk percentage based on Lip et al. (2010). |
Recommendation |
Clinical guidance regarding anticoagulation based on sex-specific thresholds. |
References
Lip GY, Nieuwlaat R, Pisters R, et al. Refining clinical risk stratification for predicting stroke and thromboembolism in atrial fibrillation using a novel risk factor-based approach: the euro heart survey on atrial fibrillation. Chest. 2010;137(2):263-272. doi:10.1378/chest.09-1584
Examples
# Example 1: High Risk Male
# 76yo (+2), HTN (+1), No other factors
# Score = 3
cha2ds2_vasc_score(76, "male", 0, 1, 0, 0, 0)
# Example 2: Low Risk Female
# 50yo, Female (+1), No other risk factors
# Score = 1 (Low risk for females)
cha2ds2_vasc_score(50, "female", 0, 0, 0, 0, 0)
CHADS2 Score for Atrial Fibrillation Stroke Risk
Description
Calculates the CHADS2 score to estimate the risk of stroke in patients with non-rheumatic atrial fibrillation. The score is used to determine whether anticoagulation therapy (e.g., warfarin, aspirin) is indicated.
Usage
chads2_score(chf, hypertension, age, diabetes, stroke_tia)
Arguments
chf |
Numeric (0 or 1). History of Congestive Heart Failure. (1 = Yes, +1 point). |
hypertension |
Numeric (0 or 1). History of Hypertension. (1 = Yes, +1 point). |
age |
Numeric. Patient age in years. (>= 75 years adds +1 point). |
diabetes |
Numeric (0 or 1). History of Diabetes Mellitus. (1 = Yes, +1 point). |
stroke_tia |
Numeric (0 or 1). History of prior Stroke or TIA. (1 = Yes, +2 points). |
Value
A list containing:
CHADS2_Score |
The calculated score (Range 0-6). |
Risk_Category |
Classification (Low, Moderate, High). |
Annual_Stroke_Risk |
Estimated annual stroke risk percentage without anticoagulation. |
References
Gage BF, Waterman AD, Shannon W, et al. Validation of clinical classification schemes for predicting stroke: results from the National Registry of Atrial Fibrillation. JAMA. 2001;285(22):2864-2870. doi:10.1001/jama.285.22.2864
Examples
# Example 1: High Risk
# 76yo (+1), History of Stroke (+2)
# Score = 3
chads2_score(0, 0, 76, 0, 1)
# Example 2: Moderate Risk
# 60yo (0), Hypertension (+1)
# Score = 1
chads2_score(0, 1, 60, 0, 0)
CHADS-65 Score (Canadian Cardiovascular Society)
Description
Calculates the CHADS-65 score for atrial fibrillation stroke risk stratification, based on the Canadian Cardiovascular Society (CCS) guidelines. This score modifies the standard CHADS2 score by lowering the age threshold to 65. It is used to guide the decision for Oral Anticoagulant (OAC) therapy.
Usage
chads_65_score(age, chf, hypertension, diabetes, stroke_tia)
Arguments
age |
Numeric. Patient age in years. (>= 65 years adds +1 point). |
chf |
Numeric (0 or 1). Congestive Heart Failure. (1 = Yes, +1 point). |
hypertension |
Numeric (0 or 1). History of Hypertension. (1 = Yes, +1 point). |
diabetes |
Numeric (0 or 1). Diabetes Mellitus. (1 = Yes, +1 point). |
stroke_tia |
Numeric (0 or 1). History of Stroke or TIA. (1 = Yes, +2 points). |
Value
A list containing:
CHADS_65_Score |
The calculated score (Range 0-6). |
Recommendation |
Clinical guidance regarding antithrombotic therapy. |
References
Andrade JG, et al. 2018 Focused Update of the Canadian Cardiovascular Society Guidelines for the Management of Atrial Fibrillation. Can J Cardiol. 2018;34(11):1371-1392. doi:10.1016/j.cjca.2018.08.026
Examples
# Example 1: High Risk
# 66yo (+1), No other factors
# Score = 1 -> OAC Recommended
chads_65_score(66, 0, 0, 0, 0)
# Example 2: Low Risk
# 50yo, No risk factors
# Score = 0 -> No therapy
chads_65_score(50, 0, 0, 0, 0)
CHALICE Rule (Children's Head Injury Algorithm for the Prediction of Important Clinical Events)
Description
Applies the CHALICE clinical decision rule to identify children with minor head injury who are at high risk for significant intracranial pathology and require a CT scan. The rule is considered positive if any one of the history, mechanism, or examination criteria is met.
Usage
chalice_head_injury_rule(age_years, gcs_score, witnessed_loc_gt_5min,
amnesia_gt_5min, abnormal_drowsiness, vomiting_ge_3,
suspicion_nai, seizure, high_speed_mva, fall_gt_3m,
high_speed_object, open_depressed_fx_tense_fontanelle,
basal_skull_fx_signs, focal_neuro_deficit,
scalp_swelling_laceration_gt_5cm)
Arguments
age_years |
Numeric. Patient age in years. (Used to adjust GCS threshold and swelling criteria). |
gcs_score |
Numeric. Glasgow Coma Scale score. (Positive if < 14, or < 15 if age < 1 year). |
witnessed_loc_gt_5min |
Numeric (0 or 1). Witnessed Loss of Consciousness > 5 minutes. (1 = Yes). |
amnesia_gt_5min |
Numeric (0 or 1). History of amnesia > 5 minutes. (1 = Yes). |
abnormal_drowsiness |
Numeric (0 or 1). Abnormal drowsiness (drowsy, or only responding to voice/pain). (1 = Yes). |
vomiting_ge_3 |
Numeric (0 or 1). >= 3 episodes of vomiting after injury. (1 = Yes). |
suspicion_nai |
Numeric (0 or 1). Suspicion of Non-Accidental Injury (Child Abuse). (1 = Yes). |
seizure |
Numeric (0 or 1). Seizure after injury (in patient without epilepsy). (1 = Yes). |
high_speed_mva |
Numeric (0 or 1). High-speed road traffic accident (> 40 mph / 64 kph) as pedestrian, cyclist, or occupant. (1 = Yes). |
fall_gt_3m |
Numeric (0 or 1). Fall from height > 3 meters. (1 = Yes). |
high_speed_object |
Numeric (0 or 1). High-speed injury from projectile or falling object. (1 = Yes). |
open_depressed_fx_tense_fontanelle |
Numeric (0 or 1). Suspicion of open or depressed skull fracture or tense fontanelle. (1 = Yes). |
basal_skull_fx_signs |
Numeric (0 or 1). Signs of basal skull fracture (Battle's sign, panda eyes, hemotympanum, CSF leak). (1 = Yes). |
focal_neuro_deficit |
Numeric (0 or 1). Focal neurological deficit. (1 = Yes). |
scalp_swelling_laceration_gt_5cm |
Numeric (0 or 1). Bruise, swelling, or laceration > 5cm on head. (1 = Yes). Note: Only triggers rule if age < 1 year. |
Value
A list containing:
Recommendation |
"CT Head Indicated" or "CT Head Not Indicated". |
Risk_Factors_Present |
List of specific criteria met that triggered the recommendation. |
References
Dunning J, Daly JP, Lomas JP, et al. Derivation of the children's head injury algorithm for the prediction of important clinical events decision rule for head injury in children. Arch Dis Child. 2006;91(11):885-891. doi:10.1136/adc.2005.083980
Examples
# Example 1: High Risk Infant
# 6 months old, Swelling > 5cm
chalice_head_injury_rule(0.5, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)
# Example 2: Low Risk Child
# 5 years old, GCS 15, minor fall, 1 vomit
chalice_head_injury_rule(5, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Charlson Comorbidity Index (CCI)
Description
Calculates the age-adjusted Charlson Comorbidity Index (CCI). This score predicts the 10-year survival for a patient who may have a range of comorbid conditions, such as heart disease, AIDS, or cancer (a total of 22 conditions). Each condition is assigned a score of 1, 2, 3, or 6, depending on the risk of dying associated with each one.
Usage
charlson_comorbidity_index(age, myocardial_infarction, chf, pvd, cva_tia,
dementia, copd, connective_tissue_disease,
peptic_ulcer_disease, liver_disease, diabetes,
hemiplegia, renal_disease, solid_tumor, leukemia,
lymphoma, aids)
Arguments
age |
Numeric. Patient age in years. < 50: 0 pts. 50-59: 1 pt. 60-69: 2 pts. 70-79: 3 pts. >= 80: 4 pts. |
myocardial_infarction |
Numeric (0 or 1). History of Myocardial Infarction. (1 = Yes, +1 pt). |
chf |
Numeric (0 or 1). Congestive Heart Failure. (1 = Yes, +1 pt). |
pvd |
Numeric (0 or 1). Peripheral Vascular Disease. (1 = Yes, +1 pt). |
cva_tia |
Numeric (0 or 1). Cerebrovascular Accident or TIA. (1 = Yes, +1 pt). |
dementia |
Numeric (0 or 1). Dementia. (1 = Yes, +1 pt). |
copd |
Numeric (0 or 1). Chronic Obstructive Pulmonary Disease. (1 = Yes, +1 pt). |
connective_tissue_disease |
Numeric (0 or 1). Connective Tissue Disease. (1 = Yes, +1 pt). |
peptic_ulcer_disease |
Numeric (0 or 1). Peptic Ulcer Disease. (1 = Yes, +1 pt). |
liver_disease |
String. "none" (0 pts), "mild" (Chronic Hepatitis, Cirrhosis without portal hypertension: +1 pt), or "moderate_severe" (Cirrhosis with portal hypertension, variceal bleeding: +3 pts). |
diabetes |
String. "none" (0 pts), "uncomplicated" (Diet-controlled or meds: +1 pt), or "end_organ_damage" (Retinopathy, Neuropathy, Nephropathy: +2 pts). |
hemiplegia |
Numeric (0 or 1). Hemiplegia. (1 = Yes, +2 pts). |
renal_disease |
Numeric (0 or 1). Moderate to Severe Chronic Kidney Disease. (1 = Yes, +2 pts). |
solid_tumor |
String. "none" (0 pts), "localized" (Localized solid tumor: +2 pts), or "metastatic" (Metastatic solid tumor: +6 pts). |
leukemia |
Numeric (0 or 1). Leukemia. (1 = Yes, +2 pts). |
lymphoma |
Numeric (0 or 1). Lymphoma. (1 = Yes, +2 pts). |
aids |
Numeric (0 or 1). AIDS. (1 = Yes, +6 pts). |
Value
A list containing:
CCI_Score |
The total calculated Charlson Comorbidity Index. |
Estimated_10_Year_Survival |
Estimated percentage survival over 10 years. |
References
Charlson ME, Pompei P, Ales KL, MacKenzie CR. A new method of classifying prognostic comorbidity in longitudinal studies: development and validation. J Chronic Dis. 1987;40(5):373-383. doi:10.1016/0021-9681(87)90171-8
Examples
# Example 1: High Risk
# 75yo (+3), Diabetes w/ End Organ Damage (+2), CHF (+1), MI (+1)
# Score = 7
charlson_comorbidity_index(75, 1, 1, 0, 0, 0, 0, 0, 0,
"none", "end_organ_damage", 0, 0, "none", 0, 0, 0)
# Example 2: Low Risk
# 45yo (0), Uncomplicated Diabetes (+1)
# Score = 1
charlson_comorbidity_index(45, 0, 0, 0, 0, 0, 0, 0, 0,
"none", "uncomplicated", 0, 0, "none", 0, 0, 0)
tPA Contraindications for Ischemic Stroke
Description
Evaluates a patient for contraindications to intravenous tissue plasminogen activator (tPA) therapy for acute ischemic stroke. This function checks standard exclusion criteria based on AHA/ASA guidelines, including timing, history of hemorrhage, recent surgery/trauma, severe hypertension, and coagulopathy.
Usage
check_tpa_contraindications(symptom_duration_hours, age, disability_status, ich_history,
intracranial_neoplasm_avm_aneurysm,
recent_intracranial_spinal_surgery, active_internal_bleeding,
suspected_aortic_dissection, severe_uncontrolled_hypertension,
recent_stroke, recent_head_trauma, current_anticoagulant_use,
platelet_count, inr, aptt, pt, glucose)
Arguments
symptom_duration_hours |
Numeric. Time from onset of symptoms (or last known normal) in hours. (> 4.5 hours is a contraindication). |
age |
Numeric. Patient age in years. (Age > 80 is a relative contraindication in the 3-4.5h window). |
disability_status |
Numeric (0 or 1). Severe disability prior to stroke (mRS > 1). (Often a relative contraindication). |
ich_history |
Numeric (0 or 1). History of intracranial hemorrhage. (1 = Yes). |
intracranial_neoplasm_avm_aneurysm |
Numeric (0 or 1). Presence of intracranial neoplasm, arteriovenous malformation, or aneurysm. (1 = Yes). |
recent_intracranial_spinal_surgery |
Numeric (0 or 1). Recent intracranial or spinal surgery (within 3 months). (1 = Yes). |
active_internal_bleeding |
Numeric (0 or 1). Active internal bleeding. (1 = Yes). |
suspected_aortic_dissection |
Numeric (0 or 1). Clinical suspicion of aortic dissection. (1 = Yes). |
severe_uncontrolled_hypertension |
Numeric (0 or 1). Severe uncontrolled hypertension (SBP > 185 or DBP > 110) unresponsive to treatment. (1 = Yes). |
recent_stroke |
Numeric (0 or 1). Recent ischemic stroke (within 3 months). (1 = Yes). |
recent_head_trauma |
Numeric (0 or 1). Recent significant head trauma (within 3 months). (1 = Yes). |
current_anticoagulant_use |
Numeric (0 or 1). Current use of anticoagulant medication (e.g., warfarin, DOACs). (1 = Yes). |
platelet_count |
Numeric. Platelet count in /mm^3. (< 100,000 is a contraindication). |
inr |
Numeric. International Normalized Ratio. (> 1.7 is a contraindication). |
aptt |
Numeric. Activated Partial Thromboplastin Time in seconds. (Elevated aPTT in heparin users is a contraindication). |
pt |
Numeric. Prothrombin Time in seconds. (> 15s is a contraindication). |
glucose |
Numeric. Blood glucose level in mg/dL. (< 50 mg/dL is a contraindication). |
Value
A list containing:
Recommendation |
"tPA Contraindicated" or "tPA May be Indicated". |
Contraindications_Present |
A list of specific contraindications identified. |
References
Powers WJ, et al. 2018 Guidelines for the Early Management of Patients With Acute Ischemic Stroke: A Guideline for Healthcare Professionals From the American Heart Association/American Stroke Association. Stroke. 2018.
Examples
# Example 1: Contraindicated (Time window)
# 5 hours duration, otherwise normal
check_tpa_contraindications(5, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250000, 1.0, 30, 12, 100)
# Example 2: Contraindicated (History of ICH)
# 2 hours, Hx ICH
check_tpa_contraindications(2, 70, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 200000, 1.0, 30, 12, 90)
# Example 3: Indicated
# 2 hours, No contraindications
check_tpa_contraindications(2, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 200000, 1.0, 30, 12, 100)
Children's Hospital of Eastern Ontario Pain Scale (CHEOPS)
Description
Calculates the CHEOPS score, a behavioral observation scale for assessing postoperative pain in children aged 1-7 years. The scale evaluates six behaviors: Cry, Facial, Child Verbal, Torso, Touch, and Legs. A score of 6 or higher generally indicates the need for analgesic intervention.
Usage
cheops_pain_scale(cry, facial, verbal, torso, touch, legs)
Arguments
cry |
Numeric. 1: No cry. 2: Moaning or Crying. 3: Scream. |
facial |
Numeric. 0: Smiling. 1: Composed/Neutral. 2: Grimace. |
verbal |
Numeric. 0: Positive statements. 1: None or Complaints other than pain. 2: Pain complaints or Both pain/non-pain complaints. |
torso |
Numeric. 1: Neutral. 2: Shifting, tense, shivering, upright, or restrained. |
touch |
Numeric. 1: Not touching. 2: Reaching, touching, grabbing, or restrained. |
legs |
Numeric. 1: Neutral. 2: Squirming, kicking, drawn up, tensed, standing, or restrained. |
Value
A list containing:
CHEOPS_Score |
The calculated total score (Range 4-13). |
Interpretation |
Clinical guidance based on the threshold of 6. |
References
McGrath PJ, Johnson G, Goodman JT, et al. CHEOPS: a behavioral scale for rating postoperative pain in children. Advances in Pain Research and Therapy. 1985;9:395-402.
Examples
# Example 1: Significant Pain
# Crying (2), Grimace (2), Pain complaints (2), Tense torso (2), Touching wound (2), Kicking (2)
# Score = 12
cheops_pain_scale(2, 2, 2, 2, 2, 2)
# Example 2: Comfortable Child
# No cry (1), Composed (1), No verbal (1), Neutral torso (1), Not touching (1), Neutral legs (1)
# Score = 6 (Threshold)
cheops_pain_scale(1, 1, 1, 1, 1, 1)
# Example 3: Very Comfortable
# No cry (1), Smiling (0), Positive verbal (0), Neutral torso (1), Not touching (1),
#Neutral legs (1)
# Score = 4
cheops_pain_scale(1, 0, 0, 1, 1, 1)
Child-Pugh Score for Cirrhosis Mortality
Description
Calculates the Child-Pugh Score (also known as the Child-Turcotte-Pugh Score) to assess the prognosis of chronic liver disease, primarily cirrhosis. The score aggregates five clinical and laboratory measures to categorize patients into Class A, B, or C, which correlates with 1- and 2-year survival rates.
Usage
child_pugh_score(bilirubin, albumin, inr, ascites, encephalopathy,
pbc_or_psc = 0, bilirubin_units = "mg/dL",
albumin_units = "g/dL")
Arguments
bilirubin |
Numeric. Total bilirubin level. |
albumin |
Numeric. Serum albumin level. |
inr |
Numeric. International Normalized Ratio (INR). |
ascites |
String. Degree of ascites. Options: "none" (+1 pt), "slight" (Supressed with meds, +2 pts), "moderate" (Refractory, +3 pts). |
encephalopathy |
String. Degree of encephalopathy. Options: "none" (+1 pt), "grade_1_2" (or medically controlled, +2 pts), "grade_3_4" (or poorly controlled, +3 pts). |
pbc_or_psc |
Numeric (0 or 1). Patient has Primary Biliary Cholangitis (PBC) or Primary Sclerosing Cholangitis (PSC). (1 = Yes). If Yes, modified bilirubin thresholds are used (<4, 4-10, >10 mg/dL). |
bilirubin_units |
String. "mg/dL" (default) or "umol/L". |
albumin_units |
String. "g/dL" (default) or "g/L". |
Value
A list containing:
Child_Pugh_Score |
The total calculated score (Range 5-15). |
Class |
The Child-Pugh Class (A, B, or C). |
Life_Expectancy_1_Year |
Estimated 1-year survival rate. |
Life_Expectancy_2_Year |
Estimated 2-year survival rate. |
References
Pugh RN, Murray-Lyon IM, Dawson JL, Pietroni MC, Williams R. Transection of the oesophagus for bleeding oesophageal varices. Br J Surg. 1973;60(8):646-649. doi:10.1002/bjs.1800600817
Examples
# Example 1: Class A
# Bili 1.0, Alb 4.0, INR 1.0, No Ascites, No Enceph
child_pugh_score(1.0, 4.0, 1.0, "none", "none")
# Example 2: Class C
# Bili 4.0, Alb 2.0, INR 2.5, Moderate Ascites, Grade 3 Enceph
child_pugh_score(4.0, 2.0, 2.5, "moderate", "grade_3_4")
CHIP Prediction Rule for CT in Head Injury Patients
Description
Applies the CHIP (CT in Head Injury Patients) Prediction Rule to determine the need for a CT scan in patients with minor head injury (GCS 13-15). The rule identifies patients at high risk for intracranial complications requiring neurosurgical intervention.
Usage
chip_head_injury_rule(age, gcs, vomiting, amnesia, skull_fracture_signs,
neurological_deficit, seizure, coagulopathy,
dangerous_mechanism)
Arguments
age |
Numeric. Patient age in years. (>= 60 years is a risk factor). |
gcs |
Numeric. Glasgow Coma Scale score. (< 15 is a risk factor). |
vomiting |
Numeric (0 or 1). Any episode of vomiting. (1 = Yes). |
amnesia |
Numeric (0 or 1). Post-traumatic amnesia (anterograde > 4 hours) or retrograde amnesia (> 30 minutes). (1 = Yes). |
skull_fracture_signs |
Numeric (0 or 1). Clinical signs of skull fracture (depressed, basal, or penetrating). (1 = Yes). |
neurological_deficit |
Numeric (0 or 1). Any focal neurological deficit. (1 = Yes). |
seizure |
Numeric (0 or 1). Post-traumatic seizure. (1 = Yes). |
coagulopathy |
Numeric (0 or 1). History of coagulopathy or use of anticoagulant medication (e.g., warfarin). (1 = Yes). |
dangerous_mechanism |
Numeric (0 or 1). High-energy mechanism of injury (e.g., Pedestrian/cyclist vs vehicle, ejection from vehicle, fall from elevation > 1m/5 stairs). (1 = Yes). |
Value
A list containing:
Recommendation |
"CT Head Indicated" or "CT Head Not Indicated". |
Risk_Factors_Present |
A list of the specific criteria met that triggered the indication for CT. |
References
Smits M, Dippel DW, Steyerberg EW, et al. Predicting intracranial traumatic findings on computed tomography in patients with minor head injury: the CHIP prediction rule. Ann Intern Med. 2007;146(6):397-405. doi:10.7326/0003-4819-146-6-200703200-00004
Examples
# Example 1: High Risk (Age)
# 70yo, GCS 15, no other symptoms
chip_head_injury_rule(70, 15, 0, 0, 0, 0, 0, 0, 0)
# Example 2: Low Risk
# 30yo, GCS 15, minor mechanism, no symptoms
chip_head_injury_rule(30, 15, 0, 0, 0, 0, 0, 0, 0)
# Example 3: High Risk (Vomiting)
# 25yo, GCS 15, Vomiting present
chip_head_injury_rule(25, 15, 1, 0, 0, 0, 0, 0, 0)
CholeS Score for Laparoscopic Cholecystectomy Duration
Description
Calculates the CholeS Score to predict the duration and difficulty of elective laparoscopic cholecystectomy. This score, derived from the CholeS Study, helps in operating list planning and identifying cases that may require senior surgical expertise due to predicted complexity.
Usage
choles_score_duration(sex, age, history_acute_cholecystitis, bmi, asa_class_ge_3)
Arguments
sex |
String. Patient sex ("Male" or "Female"). (Male adds +1 point). |
age |
Numeric. Patient age in years. < 60: 0 pts. 60-70: 1 pt. > 70: 2 pts. |
history_acute_cholecystitis |
Numeric (0 or 1). History of acute cholecystitis. (1 = Yes, +1 point). |
bmi |
Numeric. Body Mass Index (kg/m^2). < 30: 0 pts. 30-35: 1 pt. > 35: 2 pts. |
asa_class_ge_3 |
Numeric (0 or 1). ASA Physical Status III, IV, or V. (1 = Yes, +1 point). |
Value
A list containing:
CholeS_Score |
The calculated score (Range 0-7). |
Risk_Category |
Risk stratification (Low, Medium, High). |
Est_Duration |
Estimated mean duration of surgery. |
References
CholeS Study Group, West Midlands Research Collaborative. Population-based cohort study of variation in the use of emergency cholecystectomy for benign gallbladder diseases. Br J Surg. 2016;103(12):1716-1726.
Examples
# Example 1: High Difficulty
# Male (+1), 75yo (+2), Hx Acute Chole (+1), BMI 36 (+2), ASA III (+1)
# Score = 7
choles_score_duration("male", 75, 1, 36, 1)
# Example 2: Low Difficulty
# Female (0), 45yo (0), No Hx (0), BMI 28 (0), ASA I (0)
# Score = 0
choles_score_duration("female", 45, 0, 28, 0)
CHOSEN Risk Score for COVID-19 Safe Discharge
Description
Calculates the CHOSEN (COVID Home Safely Now) score to predict the likelihood of a safe discharge for patients with COVID-19. The model uses Age, Sex, Respiratory Rate, Oxygen Saturation, and Albumin to estimate the probability of not requiring ICU admission, intubation, or dying (safe discharge).
Usage
chosen_covid_risk_score(age, sex, respiratory_rate, spo2, albumin,
albumin_units = "g/dL")
Arguments
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. |
spo2 |
Numeric. Oxygen saturation on room air (%). |
albumin |
Numeric. Serum albumin level. |
albumin_units |
String. Units for albumin. "g/dL" (default) or "g/L". |
Value
A list containing:
Probability_Safe_Discharge |
The estimated percentage chance of a safe outcome (no ICU/Intubation/Death). |
Risk_Category |
Classification (Low/Safe, Intermediate, High/Unsafe). |
Recommendation |
Clinical guidance regarding discharge vs. admission. |
References
Chopra V, et al. Development and Validation of a Score to Predict Safe Discharge in Patients with COVID-19. Detroit Medical Center. 2020. (Contextual reference).
Examples
# Example 1: Safe Candidate
# 40yo Female, RR 16, SpO2 98%, Alb 4.0
chosen_covid_risk_score(40, "female", 16, 98, 4.0)
# Example 2: High Risk
# 75yo Male, RR 24, SpO2 92%, Alb 2.5
chosen_covid_risk_score(75, "male", 24, 92, 2.5)
COVID-19 Inpatient Risk Calculator (CIRC)
Description
Calculates the CIRC score to estimate the probability of death within 7 days of hospital admission for patients with COVID-19. Developed by Johns Hopkins researchers, this model uses patient demographics, comorbidities (Charlson Index), and admission vital signs to stratify mortality risk.
Usage
circ_covid_risk(age, race_black, nursing_home_resident, charlson_score, bmi,
temp_c, respiratory_rate, heart_rate, spo2, sbp)
Arguments
age |
Numeric. Patient age in years. |
race_black |
Numeric (0 or 1). Is the patient Black/African American? (1 = Yes). (Included as a variable in the original derivation model). |
nursing_home_resident |
Numeric (0 or 1). Was the patient admitted from a nursing home or assisted living facility? (1 = Yes). |
charlson_score |
Numeric. The patient's Charlson Comorbidity Index (CCI) score. |
bmi |
Numeric. Body Mass Index in kg/m^2. |
temp_c |
Numeric. Admission temperature in degrees Celsius. |
respiratory_rate |
Numeric. Admission respiratory rate in breaths/min. |
heart_rate |
Numeric. Admission heart rate in bpm. |
spo2 |
Numeric. Admission oxygen saturation (%) on room air or O2. |
sbp |
Numeric. Admission Systolic Blood Pressure in mmHg. |
Value
A list containing:
Est_Mortality_Risk_7_Day |
Estimated percentage probability of mortality within 7 days. |
Risk_Category |
General risk classification (Low, Moderate, High). |
References
Garibaldi BT, Fiksel J, Muschelli J, et al. Patient Trajectories Among Persons Hospitalized for COVID-19: A Cohort Study. Ann Intern Med. 2021;174(1):33-41. doi:10.7326/M20-3905
Examples
# Example 1: High Risk
# 80yo, Nursing Home, CCI 6, Hypoxic (88%), Tachypneic
circ_covid_risk(80, 0, 1, 6, 24, 37.5, 30, 110, 88, 110)
# Example 2: Low Risk
# 40yo, Home, CCI 0, Normal vitals
circ_covid_risk(40, 0, 0, 0, 22, 36.8, 14, 70, 98, 120)
Cumulative Illness Rating Scale for Geriatrics (CIRS-G)
Description
Calculates the CIRS-G score, a comprehensive method for quantifying the burden of chronic illness in geriatric patients. The scale evaluates 14 body systems, each rated from 0 (None) to 4 (Extremely Severe), providing a total score and severity index.
Usage
cirs_geriatric_score(heart, vascular, hematopoietic, respiratory, eent,
upper_gi, lower_gi, liver, renal, gu, msk, neuro,
endocrine, psych)
Arguments
heart |
Numeric (0-4). Heart disease severity. |
vascular |
Numeric (0-4). Vascular disease severity. |
hematopoietic |
Numeric (0-4). Hematopoietic system severity. |
respiratory |
Numeric (0-4). Respiratory system severity. |
eent |
Numeric (0-4). Eyes, Ears, Nose, Throat, Larynx severity. |
upper_gi |
Numeric (0-4). Upper GI severity. |
lower_gi |
Numeric (0-4). Lower GI severity. |
liver |
Numeric (0-4). Liver severity. |
renal |
Numeric (0-4). Renal severity. |
gu |
Numeric (0-4). Genitourinary severity. |
msk |
Numeric (0-4). Musculoskeletal/Integumentary severity. |
neuro |
Numeric (0-4). Neurological severity. |
endocrine |
Numeric (0-4). Endocrine/Metabolic severity. |
psych |
Numeric (0-4). Psychiatric/Behavioral severity. |
Details
General Scoring Guidelines: 0: None. 1: Mild (Impairment does not interfere with normal activity). 2: Moderate (Impairment interferes with normal activity; meds may be needed). 3: Severe (Significant disability; chronic problems are uncontrollably). 4: Extremely Severe (Life-threatening; emergency treatment required).
Value
A list containing:
CIRS_G_Total_Score |
Sum of all items (Range 0-56). |
Severity_Index |
Total score divided by the number of categories (14). |
Number_of_Categories_Endorsed |
Count of systems with a score > 0. |
References
Miller MD, Paradis CF, Houck PR, et al. Rating chronic medical illness burden in geropsychiatric practice and research: application of the Cumulative Illness Rating Scale. Psychiatry Res. 1992;41(3):237-248. doi:10.1016/0165-1781(92)90005-n
Examples
# Example 1: High Burden
# Moderate heart (2), Severe vascular (3), Mild renal (1), others 0
# Score = 6
cirs_geriatric_score(2, 3, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0)
# Example 2: Low Burden
# Mild MSK (1), others 0
# Score = 1
cirs_geriatric_score(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0)
Clinical Index of Stable Febrile Neutropenia (CISNE)
Description
Calculates the CISNE score to predict the risk of serious complications (e.g., hypotension, organ failure, major bleeding) in patients with solid tumors presenting with apparently stable febrile neutropenia. This tool helps identify low-risk patients who may be candidates for outpatient management.
Usage
cisne_score(ecog_ge_2, copd, cvd, mucositis_ge_2, monocytes_lt_200,
stress_hyperglycemia)
Arguments
ecog_ge_2 |
Numeric (0 or 1). ECOG Performance Status >= 2. (1 = Yes, +2 points). |
copd |
Numeric (0 or 1). Chronic Obstructive Pulmonary Disease. (1 = Yes, +1 point). |
cvd |
Numeric (0 or 1). Chronic Cardiovascular Disease (e.g., history of MI, heart failure). (1 = Yes, +1 point). |
mucositis_ge_2 |
Numeric (0 or 1). Mucositis NCI Grade >= 2 (moderate to severe). (1 = Yes, +1 point). |
monocytes_lt_200 |
Numeric (0 or 1). Monocytes < 200 per uL. (1 = Yes, +1 point). |
stress_hyperglycemia |
Numeric (0 or 1). Stress-induced hyperglycemia (defined as glucose > 120 mg/dL in absence of diabetes, or patient has history of diabetes). (1 = Yes, +2 points). |
Value
A list containing:
CISNE_Score |
The calculated score (Range 0-8). |
Risk_Class |
Classification (Low: 0, Intermediate: 1-2, High: >=3). |
Est_Serious_Complication_Rate |
Estimated percentage risk of serious complications. |
Recommendation |
Guidance on inpatient vs. outpatient management. |
References
Carmona-Bayonas A, Jiménez-Fonseca P, Virizuela Echaburu J, et al. Prediction of serious complications in patients with seemingly stable febrile neutropenia: validation of the Clinical Index of Stable Febrile Neutropenia (CISNE). J Clin Oncol. 2015;33(5):465-471. doi:10.1200/JCO.2014.57.2347
Examples
# Example 1: High Risk
# ECOG 2 (+2), Diabetes/Hyperglycemia (+2)
# Score = 4
cisne_score(1, 0, 0, 0, 0, 1)
# Example 2: Low Risk
# No risk factors present
# Score = 0
cisne_score(0, 0, 0, 0, 0, 0)
Clinical Institute Withdrawal Assessment for Alcohol, Revised (CIWA-Ar)
Description
Calculates the CIWA-Ar score, the gold-standard tool for assessing the severity of alcohol withdrawal syndrome. The scale consists of 10 items: 9 items scored 0-7 and 1 item (Orientation) scored 0-4. The total score guides the administration of benzodiazepines in symptom-triggered protocols.
Usage
ciwa_ar_alcohol_withdrawal(nausea_vomiting, tremor, paroxysmal_sweats, anxiety,
agitation, tactile_disturbances, auditory_disturbances,
visual_disturbances, headache, orientation)
Arguments
nausea_vomiting |
Numeric (0-7). 0=None, 4=Intermittent nausea/dry heaves, 7=Constant nausea/vomiting. |
tremor |
Numeric (0-7). 0=No tremor, 7=Severe, visible with arms not extended. |
paroxysmal_sweats |
Numeric (0-7). 0=No sweat visible, 7=Drenching sweats. |
anxiety |
Numeric (0-7). 0=No anxiety, 7=Acute panic states. |
agitation |
Numeric (0-7). 0=Normal activity, 7=Pacing constantly/thrashing. |
tactile_disturbances |
Numeric (0-7). 0=None, 7=Continuous hallucinations. |
auditory_disturbances |
Numeric (0-7). 0=None, 7=Continuous hallucinations. |
visual_disturbances |
Numeric (0-7). 0=None, 7=Continuous hallucinations. |
headache |
Numeric (0-7). 0=None, 7=Very severe. |
orientation |
Numeric (0-4). 0=Oriented, 4=Disoriented to place and person. |
Value
A list containing:
CIWA_Ar_Score |
The calculated total score (Range 0-67). |
Severity_Category |
Classification (Mild <8, Moderate 8-15, Severe >15). |
Management_Guideline |
General treatment recommendation based on severity. |
References
Sullivan JT, Sykora K, Schneiderman J, Naranjo CA, Sellers EM. Assessment of alcohol withdrawal: the revised clinical institute withdrawal assessment for alcohol scale (CIWA-Ar). Br J Addict. 1989;84(11):1353-1357. doi:10.1111/j.1360-0443.1989.tb00737.x
Examples
# Example 1: Severe Withdrawal
# Tremor 7, Sweats 7, Agitation 5, Hallucinations 3
# Score = 22
ciwa_ar_alcohol_withdrawal(0, 7, 7, 0, 5, 0, 0, 3, 0, 0)
# Example 2: Mild Withdrawal
# Tremor 2, Anxiety 2
# Score = 4
ciwa_ar_alcohol_withdrawal(0, 2, 0, 2, 0, 0, 0, 0, 0, 0)
CKD-EPI Equations for Glomerular Filtration Rate (GFR)
Description
Calculates the Estimated Glomerular Filtration Rate (eGFR) using the CKD-EPI equations. This function includes the recommended 2021 Race-Free Creatinine equation, the 2021 Race-Free Creatinine-Cystatin C equation, the 2012 Cystatin C equation, and the older 2009 Race-Based Creatinine equation for comparison.
Usage
ckd_epi_gfr(age, sex, creatinine, cystatin_c = NULL, race_black = FALSE,
creatinine_units = "mg/dL", cystatin_units = "mg/L")
Arguments
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). |
creatinine |
Numeric. Serum Creatinine level. |
cystatin_c |
Numeric (Optional). Serum Cystatin C level. Required for Cystatin-based equations. |
race_black |
Numeric or Logical (0/1 or FALSE/TRUE). Patient is Black/African American. Used only for the 2009 equation; ignored by 2021 equations. |
creatinine_units |
String. Units for Creatinine. Options: "mg/dL" (default) or "micromol/L" (or "umol/L"). |
cystatin_units |
String. Units for Cystatin C. Options: "mg/L" (default). |
Value
A list containing:
eGFR_2021_Creatinine |
The current standard race-free estimate (mL/min/1.73m^2). |
eGFR_2021_Creatinine_Cystatin_C |
Combined race-free estimate (if Cystatin C provided). |
eGFR_2012_Cystatin_C |
Cystatin C only estimate (if provided). |
eGFR_2009_Creatinine |
The older race-based estimate. |
References
Inker LA, Eneanya ND, Coresh J, et al. New Creatinine- and Cystatin C-Based Equations to Estimate GFR Without Race. N Engl J Med. 2021;385:1737-1749. doi:10.1056/NEJMoa2102953 Levey AS, Stevens LA, Schmid CH, et al. A new equation to estimate glomerular filtration rate. Ann Intern Med. 2009;150(9):604-612.
Examples
# Example 1: Standard 2021 Creatinine (No Race Input Needed)
# Female, 58, Cr 0.9 mg/dL
ckd_epi_gfr(58, "female", 0.9)
# Example 2: Combined Creatinine-Cystatin C
# Male, 65, Cr 1.2 mg/dL, CysC 0.9 mg/L
ckd_epi_gfr(65, "male", 1.2, 0.9)
# Example 3: 2009 Comparison (Black Race)
# Male, 50, Cr 1.5 mg/dL, Race Black
ckd_epi_gfr(50, "male", 1.5, race_black = TRUE)
CKD Prediction in HIV Patients (D:A:D Score)
Description
Calculates the D:A:D (Data Collection on Adverse Events of Anti-HIV Drugs) Risk Score for Chronic Kidney Disease. This tool estimates the 5-year risk of developing CKD (defined as confirmed eGFR < 60 mL/min/1.73 m^2) in HIV-positive patients with a baseline eGFR > 60.
Usage
ckd_prediction_hiv(age, sex, iv_drug_user, baseline_egfr, current_cd4,
nadir_cd4, viral_load, hepatitis_c, history_cvd,
hypertension, diabetes)
Arguments
age |
Numeric. Patient age in years. |
sex |
String. "Male" or "Female". (Male adds +1 point). |
iv_drug_user |
Numeric (0 or 1). History of Injection Drug Use. (1 = Yes, +3 points). |
baseline_egfr |
Numeric. Baseline eGFR in mL/min/1.73 m^2. Must be >= 60. (Lower eGFR values add more points). |
current_cd4 |
Numeric. Current CD4 count in cells/mm^3. (<50: +3 pts; 50-199: +2 pts). |
nadir_cd4 |
Numeric. Nadir (lowest historical) CD4 count in cells/mm^3. (<50: +2 pts; 50-199: +1 pt). |
viral_load |
Numeric. HIV RNA Viral Load in copies/mL. (>100,000 copies/mL adds +2 points). |
hepatitis_c |
Numeric (0 or 1). Hepatitis C Coinfection (Positive antibody or RNA). (1 = Yes, +1 point). |
history_cvd |
Numeric (0 or 1). History of Cardiovascular Disease. (1 = Yes, +2 points). |
hypertension |
Numeric (0 or 1). History of Hypertension. (1 = Yes, +2 points). |
diabetes |
Numeric (0 or 1). History of Diabetes Mellitus. (1 = Yes, +4 points). |
Value
A list containing:
DAD_CKD_Score |
The calculated risk score. |
Risk_Category |
Risk stratification (Low < 10, Medium 10-19, High >= 20). |
Five_Year_Risk_Ratio |
Estimated 5-year probability of developing CKD expressed as a ratio (e.g., 1:32). |
References
Mocroft A, Kirk O, Reiss P, et al. Estimated glomerular filtration rate, chronic kidney disease and antiretroviral drug use in HIV-positive patients. AIDS. 2010;24(11):1667-1678. doi:10.1097/QAD.0b013e328339fe53
Examples
# Example 1: High Risk
# 60yo Male (+12), eGFR 65 (+15), DM (+4)
# Score = 11 + 1 + 15 + 4 = 31
ckd_prediction_hiv(60, "male", 0, 65, 500, 200, 50, 0, 0, 0, 1)
# Example 2: Low Risk
# 30yo Female, eGFR 100, No comorbidities
# Score = 0
ckd_prediction_hiv(30, "female", 0, 100, 500, 300, 0, 0, 0, 0, 0)
CKiD U25 eGFR Calculator (Bedside Schwartz)
Description
Calculates the estimated Glomerular Filtration Rate (eGFR) for children and young adults (ages 1-25) using the CKiD U25 equation. This equation is mathematically identical to the "Bedside Schwartz" (2009) formula but has been validated for use in young adults up to age 25.
Usage
ckid_u25_egfr(height_cm, creatinine, creatinine_units = "mg/dL")
Arguments
height_cm |
Numeric. Patient height in centimeters. |
creatinine |
Numeric. Serum creatinine level. |
creatinine_units |
String. Units for creatinine. Options: "mg/dL" (default), "micromol/L", or "umol/L". |
Value
A list containing:
eGFR_mL_min_1_73m2 |
The estimated GFR normalized to 1.73 m^2 body surface area. |
Method |
Description of the formula used (k = 0.413). |
References
Pierce CB, Muñoz A, Ng DK, et al. Age- and Sex-Dependent Clinical Equations to Estimate GFR in Children and Young Adults with CKD. Clin J Am Soc Nephrol. 2021;16(6):871-880. doi:10.2215/CJN.17191120 Schwartz GJ, Muñoz A, Schneider MF, et al. New equations to estimate GFR in children with CKD. J Am Soc Nephrol. 2009;20(3):629-637. doi:10.1681/ASN.2008030287
Examples
# Example 1: Child
# 120 cm, Cr 0.6 mg/dL
# eGFR = 0.413 * (120 / 0.6) = 82.6
ckid_u25_egfr(120, 0.6)
# Example 2: Young Adult (SI Units)
# 175 cm, Cr 88.4 umol/L (1.0 mg/dL)
# eGFR = 0.413 * (175 / 1.0) = 72.3
ckid_u25_egfr(175, 88.4, "umol/L")
CLIF-C ACLF Score for Acute-on-Chronic Liver Failure
Description
Calculates the CLIF-C ACLF (Consortium on Chronic Liver Failure - Acute-on-Chronic Liver Failure) score. This prognostic score is specifically designed for patients with ACLF (Acute-on-Chronic Liver Failure) to predict 28-day and 90-day mortality. It incorporates the CLIF-OF (Organ Failure) score, Age, and White Blood Cell count.
Usage
clif_c_aclf_score(age, wbc_count, bilirubin, creatinine, inr, map,
use_vasopressors, pao2_fio2_ratio, he_grade,
bilirubin_units = "mg/dL", creatinine_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. |
wbc_count |
Numeric. White Blood Cell count in x10^9/L. |
bilirubin |
Numeric. Total Bilirubin level. |
creatinine |
Numeric. Serum Creatinine level. |
inr |
Numeric. International Normalized Ratio. |
map |
Numeric. Mean Arterial Pressure in mmHg. |
use_vasopressors |
Numeric (0 or 1). Is the patient on vasopressors? (1 = Yes). |
pao2_fio2_ratio |
Numeric. PaO2/FiO2 ratio. |
he_grade |
Numeric (0-4). West Haven Grade of Hepatic Encephalopathy. |
bilirubin_units |
String. Units for bilirubin. "mg/dL" (default) or "umol/L". |
creatinine_units |
String. Units for creatinine. "mg/dL" (default) or "umol/L". |
Value
A list containing:
CLIF_C_ACLF_Score |
The calculated prognostic score. |
CLIF_OF_Score |
The intermediate Organ Failure score (Sum of 6 organ system scores). |
Est_28_Day_Mortality |
Estimated 28-day mortality probability. |
Est_90_Day_Mortality |
Estimated 90-day mortality probability. |
References
Jalan R, Saliba F, Pavesi M, et al. Development and validation of a prognostic score to predict mortality in patients with acute-on-chronic liver failure. J Hepatol. 2014;61(5):1038-1047. doi:10.1016/j.jhep.2014.06.012
Examples
# Example 1: High Mortality
# Age 60, WBC 15, Bili 15, Cr 4.0, INR 3.0, Pressors Yes, PF 150, HE Grade 3
clif_c_aclf_score(60, 15, 15, 4.0, 3.0, 60, 1, 150, 3)
# Example 2: Lower Mortality
# Age 45, WBC 8, Bili 5, Cr 1.5, INR 1.5, MAP 80, No Pressors, PF 350, HE Grade 1
clif_c_aclf_score(45, 8, 5, 1.5, 1.5, 80, 0, 350, 1)
Clinical Dementia Rating (CDR) Scale
Description
Calculates the Global CDR Score and the CDR Sum of Boxes (CDR-SB). The CDR is a global rating scale for staging dementia severity based on six domains of cognitive and functional performance: Memory, Orientation, Judgment & Problem Solving, Community Affairs, Home & Hobbies, and Personal Care.
Usage
clinical_dementia_rating(memory, orientation, judgment, community,
home_hobbies, personal_care)
Arguments
memory |
Numeric (0, 0.5, 1, 2, 3). Assessment of memory impairment. This is the primary category that drives the algorithm. |
orientation |
Numeric (0, 0.5, 1, 2, 3). Assessment of orientation to time, place, and person. |
judgment |
Numeric (0, 0.5, 1, 2, 3). Assessment of judgment and problem-solving abilities. |
community |
Numeric (0, 0.5, 1, 2, 3). Assessment of involvement in community affairs. |
home_hobbies |
Numeric (0, 0.5, 1, 2, 3). Assessment of ability to perform home chores and hobbies. |
personal_care |
Numeric (0, 0.5, 1, 2, 3). Assessment of personal care status. |
Details
Scoring Values: 0 = None 0.5 = Questionable/Very Mild 1 = Mild 2 = Moderate 3 = Severe
The Global CDR is calculated using the standard Washington University algorithm, where Memory (M) determines the baseline, and the configuration of secondary scores determines if the global score shifts up or down. The CDR-SB is the simple sum of all 6 scores.
Value
A list containing:
Global_CDR_Score |
The staging score (0, 0.5, 1, 2, or 3). |
CDR_Sum_of_Boxes |
The sum of all domain scores (Range 0-18). Useful for tracking detailed progression. |
Stage |
Text description of the dementia severity. |
References
Morris JC. The Clinical Dementia Rating (CDR): current version and scoring rules. Neurology. 1993;43(11):2412-2414. doi:10.1212/wnl.43.11.2412-a
Examples
# Example 1: Mild Dementia
# Memory 1, others mostly 1
clinical_dementia_rating(1, 1, 1, 0.5, 1, 0.5)
# Example 2: Questionable Dementia (CDR 0.5)
# Memory 0.5, others 0.5
clinical_dementia_rating(0.5, 0.5, 0.5, 0.5, 0.5, 0.5)
# Example 3: Normal
# All 0
clinical_dementia_rating(0, 0, 0, 0, 0, 0)
International Prognostic Index for Chronic Lymphocytic Leukemia (CLL-IPI)
Description
Calculates the CLL-IPI score to predict 5-year overall survival and stratify risk in patients with Chronic Lymphocytic Leukemia. The index integrates genetic, biochemical, and clinical variables.
Usage
cll_ipi_score(tp53_deleted_or_mutated, ighv_unmutated,
beta2_microglobulin_gt_3_5, clinical_stage_advanced, age_gt_65)
Arguments
tp53_deleted_or_mutated |
Numeric (0 or 1). Presence of del(17p) and/or TP53 mutation. (1 = Yes, +4 points). |
ighv_unmutated |
Numeric (0 or 1). IGHV mutational status is unmutated. (1 = Yes, +2 points). |
beta2_microglobulin_gt_3_5 |
Numeric (0 or 1). Serum Beta-2 Microglobulin > 3.5 mg/L. (1 = Yes, +2 points). |
clinical_stage_advanced |
Numeric (0 or 1). Rai Stage I-IV or Binet Stage B-C. (1 = Yes, +1 point). |
age_gt_65 |
Numeric (0 or 1). Patient age > 65 years. (1 = Yes, +1 point). |
Value
A list containing:
CLL_IPI_Score |
The calculated risk score (Range 0-10). |
Risk_Group |
Classification (Low 0-1, Intermediate 2-3, High 4-6, Very High 7-10). |
Est_5_Year_Overall_Survival |
Estimated 5-year survival probability. |
Recommendation |
General treatment guidance based on risk group. |
References
Kutsch N, Bahlo J, Robrecht S, et al. International Prognostic Index for Chronic Lymphocytic Leukemia (CLL-IPI): an international meta-analysis. Lancet Oncol. 2016;17(6):779-790. doi:10.1016/S1470-2045(16)30029-8
Examples
# Example 1: Very High Risk
# TP53 deleted (+4), IGHV unmutated (+2), B2M > 3.5 (+2), Stage I (+1), Age 70 (+1)
# Score = 10
cll_ipi_score(1, 1, 1, 1, 1)
# Example 2: Low Risk
# No mutations, Normal B2M, Stage 0, Age 60
# Score = 0
cll_ipi_score(0, 0, 0, 0, 0)
CNS-IPI (Central Nervous System International Prognostic Index)
Description
Calculates the CNS-IPI score to predict the risk of CNS relapse in patients with Diffuse Large B-Cell Lymphoma (DLBCL) treated with R-CHOP. The score uses the five standard IPI factors plus specific involvement of the kidneys or adrenal glands.
Usage
cns_ipi_score(age, ldh_elevated, ecog_gt_1, stage_iii_iv,
extranodal_gt_1, kidney_adrenal_involvement)
Arguments
age |
Numeric. Patient age in years. (> 60 years adds +1 point). |
ldh_elevated |
Numeric (0 or 1). Serum LDH level > Normal. (1 = Yes, +1 point). |
ecog_gt_1 |
Numeric (0 or 1). ECOG Performance Status > 1. (1 = Yes, +1 point). |
stage_iii_iv |
Numeric (0 or 1). Ann Arbor Stage III or IV. (1 = Yes, +1 point). |
extranodal_gt_1 |
Numeric (0 or 1). Involvement of > 1 extranodal site. (1 = Yes, +1 point). |
kidney_adrenal_involvement |
Numeric (0 or 1). Involvement of kidney and/or adrenal glands. (1 = Yes, +1 point). |
Value
A list containing:
CNS_IPI_Score |
The calculated score (Range 0-6). |
Risk_Group |
Classification (Low 0-1, Intermediate 2-3, High 4-6). |
Est_2yr_CNS_Relapse_Risk |
Estimated 2-year risk of CNS relapse. |
References
Schmitz N, Zeynalova S, Nickelsen M, et al. CNS International Prognostic Index: A Risk Model for CNS Relapse in Patients With Diffuse Large B-Cell Lymphoma Treated With R-CHOP. J Clin Oncol. 2016;34(26):3150-3156. doi:10.1200/JCO.2015.65.6520
Examples
# Example 1: High Risk
# 65yo (+1), LDH High (+1), Stage IV (+1), >1 Extranodal (+1), Kidney Inv (+1)
# Score = 5
cns_ipi_score(65, 1, 0, 1, 1, 1)
# Example 2: Low Risk
# 50yo, Normal LDH, Stage II, No extranodal, No kidney/adrenal
# Score = 0
cns_ipi_score(50, 0, 0, 0, 0, 0)
Creatinine Clearance (Cockcroft-Gault Equation)
Description
Calculates Creatinine Clearance (CrCl) using the Cockcroft-Gault equation. This implementation replicates the MDCalc logic for weight selection: - BMI < 18.5: Uses Actual Body Weight. - BMI 18.5 - 24.9: Uses Ideal Body Weight. - BMI >= 25: Uses Adjusted Body Weight. If height is not provided, it defaults to using Actual Body Weight.
Usage
cockcroft_gault_crcl(sex, age, creatinine, weight_kg, height_cm = NULL,
creatinine_units = "mg/dL")
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age |
Numeric. Patient age in years. |
creatinine |
Numeric. Serum creatinine level. |
weight_kg |
Numeric. Actual body weight in kilograms. |
height_cm |
Numeric (Optional). Height in centimeters. Required to calculate BMI/IBW for the specific weight selection logic. |
creatinine_units |
String. Units for creatinine. Options: "mg/dL" (default) or "micromol/L". |
Value
A list containing:
CrCl_mL_min |
The estimated Creatinine Clearance. |
Weight_Used_kg |
The specific weight value used in the calculation. |
Method |
Description of which weight formula was selected (Actual, Ideal, or Adjusted). |
References
Cockcroft DW, Gault MH. Prediction of creatinine clearance from serum creatinine. Nephron. 1976;16(1):31-41. doi:10.1159/000180580 Winter MA, Guhr KN, Berg GM. Impact of various body weights and serum creatinine concentrations on the bias and accuracy of the Cockcroft-Gault equation. Pharmacotherapy. 2012;32(7):604-612.
Examples
# Example 1: Normal Weight Male
# Age 54, Cr 1.2, Wt 75kg, Ht 180cm (BMI ~23 -> Uses IBW)
cockcroft_gault_crcl("male", 54, 1.2, 75, 180)
# Example 2: Obese Female
# Age 65, Cr 0.9, Wt 90kg, Ht 160cm (BMI ~35 -> Uses Adjusted BW)
cockcroft_gault_crcl("female", 65, 0.9, 90, 160)
# Example 3: No Height Provided (Defaults to Actual Weight)
cockcroft_gault_crcl("male", 40, 1.0, 80)
Current Opioid Misuse Measure (COMM)
Description
Calculates the COMM score, a 17-item patient self-report questionnaire designed to identify current aberrant drug-related behavior in chronic pain patients prescribed opioids. Each item assesses the frequency of a specific behavior or symptom over the past 30 days.
Usage
comm_opioid_misuse_measure(q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12,
q13, q14, q15, q16, q17)
Arguments
q1 |
Numeric (0-4). Trouble thinking clearly or had memory problems? |
q2 |
Numeric (0-4). People complain that your speech is slurred or that you look sedated? |
q3 |
Numeric (0-4). Felt that your pain medication is not working or complained about it? |
q4 |
Numeric (0-4). Spent time thinking about your medication or when you will take the next dose? |
q5 |
Numeric (0-4). Taken your medication more often than prescribed? |
q6 |
Numeric (0-4). Needed to take pain medication at a higher dose than prescribed? |
q7 |
Numeric (0-4). Borrowed pain medication from someone else? |
q8 |
Numeric (0-4). Used pain medication for symptoms other than pain (e.g., sleep, mood)? |
q9 |
Numeric (0-4). Medications interfered with ability to do your job or schoolwork? |
q10 |
Numeric (0-4). Family/friends worried about your medication use? |
q11 |
Numeric (0-4). Felt angry or irritable? |
q12 |
Numeric (0-4). Had mood swings? |
q13 |
Numeric (0-4). Doctor worried about your medication use or wanted to monitor you closely? |
q14 |
Numeric (0-4). Seen other doctors to get more medication? |
q15 |
Numeric (0-4). Lied or exaggerated pain to get a prescription? |
q16 |
Numeric (0-4). Had medications lost or stolen? |
q17 |
Numeric (0-4). Had trouble with the law or driving offenses? |
Details
Scoring Key (Last 30 Days): 0 = Never 1 = Seldom 2 = Sometimes 3 = Often 4 = Very Often
Value
A list containing:
COMM_Score |
The total calculated score (Range 0-68). |
Result |
"Positive Screen" if Score >= 9, otherwise "Negative Screen". |
Interpretation |
Clinical guidance regarding the likelihood of misuse. |
References
Butler SF, Budman SH, Fernandez KC, et al. Development and validation of the Current Opioid Misuse Measure. Pain. 2007;130(1-2):144-156. doi:10.1016/j.pain.2007.01.014
Examples
# Example 1: Positive Screen
# Frequent anger (3), Mood swings (3), Thinking about meds (3)
# Score = 9
comm_opioid_misuse_measure(0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0)
# Example 2: Negative Screen
# All Never (0)
comm_opioid_misuse_measure(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Convert Common Medical Laboratory Measures Between US and SI Units
Description
Converts measurements for common medical laboratory analytes (e.g., Glucose, Creatinine, Hemoglobin) between the US Conventional unit system (US) and the International System of Units (SI). The function includes a comprehensive lookup table of conversion factors and robust error checking.
Usage
convert_lab_units(value, analyte, from_unit, to_unit)
Arguments
value |
A single numeric value of the measurement to be converted. Must be finite and non-missing. |
analyte |
A single character string specifying the substance being measured (e.g., "Glucose", "Creatinine"). Case-insensitive. |
from_unit |
A single character string specifying the starting unit system: |
to_unit |
A single character string specifying the target unit system: |
Details
The function uses a fixed set of multiplication factors (F) where US \times F = SI.
Supported Analytes and Unit Conversions:
-
Glucose: mg/dL (
US) mmol/L (SI). Factor: 0.0555 -
Creatinine: mg/dL (
US) umol/L (SI). Factor: 88.4 -
BUN (Urea Nitrogen): mg/dL (
US) mmol/L (SI). Factor: 0.357 -
Cholesterol: mg/dL (
US) mmol/L (SI). Factor: 0.0259 -
Triglycerides: mg/dL (
US) mmol/L (SI). Factor: 0.0113 -
Calcium: mg/dL (
US) mmol/L (SI). Factor: 0.25 -
Magnesium: mg/dL (
US) mmol/L (SI). Factor: 0.4114 -
Bilirubin: mg/dL (
US) umol/L (SI). Factor: 17.1 -
Sodium: mEq/L (
US) mmol/L (SI). Factor: 1.0 -
Potassium: mEq/L (
US) mmol/L (SI). Factor: 1.0 -
Hemoglobin: g/dL (
US) g/L (SI). Factor: 10.0 -
Albumin: g/dL (
US) g/L (SI). Factor: 10.0 -
Total Protein: g/dL (
US) g/L (SI). Factor: 10.0 -
Iron: ug/dL (
US) umol/L (SI). Factor: 0.1791 -
Ferritin: ng/mL (
US) pmol/L (SI). Factor: 2.247
Value
If successful, returns a character vector of length two: c(converted_value, target_unit_string). If an input error occurs, returns a character string containing a detailed error message.
Examples
#1. Convert Glucose from US (mg/dL) to SI (mmol/L)
us_glucose <- 150
convert_lab_units(us_glucose, "Glucose", "US", "SI")
#2. Convert Creatinine from SI (umol/L) to US (mg/dL)
si_creatinine <- 110
convert_lab_units(si_creatinine, "Creatinine", "SI", "US")
#3. Handling analytes with a factor of 1 (Sodium)
convert_lab_units(140, "Sodium", "US", "SI")
#4. Error Case: Unsupported analyte
convert_lab_units(5, "TSH", "US", "SI")
COPD Assessment Test (CAT)
Description
Calculates the COPD Assessment Test (CAT) score, an 8-item validated questionnaire designed to measure the overall impact of Chronic Obstructive Pulmonary Disease (COPD) on a patient's health and quality of life. Each item is scored on a 0 to 5 scale, yielding a total score from 0 to 40. The score is used in the GOLD assessment strategy.
Usage
copd_assessment_test(cough, phlegm, chest_tightness, breathlessness_stairs,
activity_limitation, confidence_leaving_home, sleep, energy)
Arguments
cough |
Numeric (0-5). Score for coughing (0=Not at all, 5=Always). |
phlegm |
Numeric (0-5). Score for phlegm/mucus in chest (0=Not at all, 5=Always). |
chest_tightness |
Numeric (0-5). Score for chest tightness (0=Not at all, 5=Always). |
breathlessness_stairs |
Numeric (0-5). Score for breathlessness going up hills or stairs (0=Not at all, 5=Extremely). |
activity_limitation |
Numeric (0-5). Score for limitation of activities at home (0=Not at all, 5=Extremely). |
confidence_leaving_home |
Numeric (0-5). Score for confidence leaving home (0=Very confident, 5=Not at all confident). |
sleep |
Numeric (0-5). Score for sleep due to COPD symptoms (0=Not at all, 5=Always). |
energy |
Numeric (0-5). Score for energy level (0=Full of energy, 5=No energy). |
Value
A list containing:
CAT_Score |
The calculated total score (Range 0-40). |
Impact_Level |
Interpretation of the score: Low (<10), Medium (10-20), High (21-30), or Very High (> 30) impact. |
References
Jones PW, Harding G, Berry P, et al. Development and first validation of the COPD Assessment Test (CAT). Eur Respir J. 2009;34(3):648-654. doi:10.1183/09031936.00102509
Examples
# Example 1: High Impact
# Mostly 4s and 5s
copd_assessment_test(5, 4, 4, 5, 5, 4, 4, 5)
# Example 2: Low Impact
# Mostly 0s and 1s
copd_assessment_test(1, 0, 0, 1, 0, 0, 0, 1)
Cornell Assessment for Pediatric Delirium (CAPD)
Description
Calculates the CAPD score to screen for delirium in critically ill infants and children. The scale consists of 8 observational items scored from 0 to 4. For items 1-4 (developmental behaviors), higher scores indicate absence of the behavior (reverse scoring is assumed to be done prior to input or user enters points directly). For items 5-8 (symptomatic behaviors), higher scores indicate frequency of the symptom.
Usage
cornell_assessment_pediatric_delirium(q1_eye_contact, q2_purposeful_actions,
q3_aware_surroundings, q4_communicate_needs,
q5_restless, q6_inconsolable,
q7_underactive, q8_response_time)
Arguments
q1_eye_contact |
Numeric (0-4). Score for eye contact with caregiver. (0=Always, 4=Never). |
q2_purposeful_actions |
Numeric (0-4). Score for purposeful actions. (0=Always, 4=Never). |
q3_aware_surroundings |
Numeric (0-4). Score for awareness of surroundings. (0=Always, 4=Never). |
q4_communicate_needs |
Numeric (0-4). Score for communicating needs/wants. (0=Always, 4=Never). |
q5_restless |
Numeric (0-4). Score for restlessness. (0=Never, 4=Always). |
q6_inconsolable |
Numeric (0-4). Score for being inconsolable. (0=Never, 4=Always). |
q7_underactive |
Numeric (0-4). Score for being underactive. (0=Never, 4=Always). |
q8_response_time |
Numeric (0-4). Score for delayed response time. (0=Never, 4=Always). |
Value
A list containing:
CAPD_Total_Score |
The sum of the 8 item scores (Range 0-32). |
Interpretation |
Screening result based on the cutoff of 9. |
References
Traube C, Silver G, Kearney J, et al. Cornell Assessment of Pediatric Delirium: a valid, rapid, observational tool for screening delirium in the PICU. Crit Care Med. 2014;42(3):656-663. doi:10.1097/CCM.0b013e3182a66b76
Examples
# Example 1: Positive for Delirium
# Child never makes eye contact (4), is always restless (4), score 8 from just two items
# Total = 4+4+0+0+4+0+0+0 = 12
cornell_assessment_pediatric_delirium(4, 4, 0, 0, 4, 0, 0, 0)
# Example 2: Negative for Delirium
# Normal behaviors (0 points each)
cornell_assessment_pediatric_delirium(0, 0, 0, 0, 0, 0, 0, 0)
Coronavirus Anxiety Scale (CAS)
Description
Calculates the Coronavirus Anxiety Scale (CAS) score, a 5-item mental health screener designed to identify probable cases of dysfunctional anxiety associated with the COVID-19 crisis. The scale focuses on the physiological manifestations of anxiety over the past 2 weeks.
Usage
coronavirus_anxiety_scale(dizziness, sleep_disturbance, paralyzed_frozen,
appetite_loss, nausea_stomach_pain)
Arguments
dizziness |
Numeric (0-4). Frequency of feeling dizzy, lightheaded, or faint when reading/listening to news about the coronavirus. |
sleep_disturbance |
Numeric (0-4). Frequency of trouble falling or staying asleep because of thinking about the coronavirus. |
paralyzed_frozen |
Numeric (0-4). Frequency of feeling paralyzed or frozen when thinking about or exposed to information about the coronavirus. |
appetite_loss |
Numeric (0-4). Frequency of losing interest in eating when thinking about or exposed to information about the coronavirus. |
nausea_stomach_pain |
Numeric (0-4). Frequency of feeling nauseous or having stomach problems when thinking about or exposed to information about the coronavirus. |
Details
Scoring Key (Frequency over last 2 weeks): 0 = Not at all. 1 = Rare, less than a day or two. 2 = Several days. 3 = More than 7 days. 4 = Nearly every day over the last 2 weeks.
Value
A list containing:
CAS_Score |
The calculated total score (Range 0-20). |
Result |
"Positive Screen" (Score >= 9) or "Negative Screen". |
Interpretation |
Clinical context regarding dysfunctional anxiety. |
References
Lee SA. Coronavirus Anxiety Scale: A brief mental health screener for COVID-19 related anxiety. Death Stud. 2020;44(7):393-401. doi:10.1080/07481187.2020.1748481
Examples
# Example 1: High Anxiety
# Dizziness (2), Sleep (3), Frozen (2), Appetite (1), Nausea (2)
# Score = 10 (Positive)
coronavirus_anxiety_scale(2, 3, 2, 1, 2)
# Example 2: Low Anxiety
# Sleep disturbance only (2), all others 0
# Score = 2 (Negative)
coronavirus_anxiety_scale(0, 2, 0, 0, 0)
COVID-GRAM Critical Illness Risk Score
Description
Calculates the COVID-GRAM score to predict the risk of developing critical illness in patients hospitalized with COVID-19. Critical illness is defined as admission to the intensive care unit, invasive mechanical ventilation, or death. The model was developed by Liang et al. using data from 575 hospitals in China.
Usage
covid_gram_score(age, x_ray_abnormality, hemoptysis, dyspnea, unconsciousness,
number_of_comorbidities, cancer_history, nlr, ldh,
direct_bilirubin, bilirubin_units = "umol/L")
Arguments
age |
Numeric. Patient age in years. |
x_ray_abnormality |
Numeric (0 or 1). Presence of radiographic abnormalities on Chest X-ray/CT. (1 = Yes). |
hemoptysis |
Numeric (0 or 1). Presence of hemoptysis. (1 = Yes). |
dyspnea |
Numeric (0 or 1). Presence of dyspnea. (1 = Yes). |
unconsciousness |
Numeric (0 or 1). Presence of unconsciousness or altered mental status. (1 = Yes). |
number_of_comorbidities |
Numeric. Count of comorbidities (e.g., COPD, hypertension, diabetes, coronary heart disease, CKD, etc.). (0, 1, or >=2). |
cancer_history |
Numeric (0 or 1). History of cancer. (1 = Yes). |
nlr |
Numeric. Neutrophil-to-lymphocyte ratio. |
ldh |
Numeric. Lactate dehydrogenase level (U/L). |
direct_bilirubin |
Numeric. Direct bilirubin level. |
bilirubin_units |
String. Units for direct bilirubin. "umol/L" (default) or "mg/dL". |
Value
A list containing:
Critical_Illness_Probability |
The estimated percentage probability of critical illness. |
Risk_Category |
Risk stratification (Low < 1.7%, Medium 1.7-40.4%, High > 40.4%). |
References
Liang W, Liang H, Ou L, et al. Development and Validation of a Clinical Risk Score to Predict the Occurrence of Critical Illness in Hospitalized Patients With COVID-19. JAMA Intern Med. 2020;180(8):1081-1089. doi:10.1001/jamainternmed.2020.2033
Examples
# Example 1: High Risk
# 70yo, Abnormal CXR, Dyspnea, 2 Comorbs, Cancer, NLR 10, LDH 400, D-Bili 6 umol/L
covid_gram_score(70, 1, 0, 1, 0, 2, 1, 10, 400, 6, "umol/L")
# Example 2: Low Risk
# 30yo, Normal CXR, No symptoms, 0 Comorbs, Normal Labs
covid_gram_score(30, 0, 0, 0, 0, 0, 0, 2, 150, 3, "umol/L")
COVID-19 Vulnerability Index (CVI)
Description
Calculates a risk score for severe COVID-19 outcomes (hospitalization, ICU admission, or death) based on demographic factors and comorbidities. This tool helps identify individuals at elevated risk to prioritize precautions or vaccination.
Usage
covid_risk_score(age_years, sex, chronic_lung_disease, kidney_disease, chf, cad,
hypertension, diabetes, cancer, stroke, nursing_home_resident)
Arguments
age_years |
Numeric. Patient age in years. <50: 0 pts. 50-64: 2 pts. 65-79: 3 pts. >=80: 5 pts. |
sex |
String. "male" (+2 pts) or "female" (0 pts). |
chronic_lung_disease |
Numeric (0 or 1). History of chronic lung disease (COPD, asthma, etc.). (1 = Yes, +1 pt). |
kidney_disease |
Numeric (0 or 1). History of chronic kidney disease. (1 = Yes, +1 pt). |
chf |
Numeric (0 or 1). History of congestive heart failure. (1 = Yes, +1 pt). |
cad |
Numeric (0 or 1). History of coronary artery disease. (1 = Yes, +1 pt). |
hypertension |
Numeric (0 or 1). History of hypertension. (1 = Yes, +1 pt). |
diabetes |
Numeric (0 or 1). History of diabetes mellitus. (1 = Yes, +1 pt). |
cancer |
Numeric (0 or 1). History of cancer (excluding non-melanoma skin cancer). (1 = Yes, +1 pt). |
stroke |
Numeric (0 or 1). History of stroke/TIA. (1 = Yes, +1 pt). |
nursing_home_resident |
Numeric (0 or 1). Resident of a nursing home or long-term care facility. (1 = Yes, +2 pts). |
Value
A list containing:
COVID_Risk_Score |
The calculated total score. |
Risk_Category |
Classification (Low <= 5, Intermediate 6-9, High >= 10). |
References
Specific reference for "COVID Risk Score" varies by institution/implementation (e.g., Cleveland Clinic, various vulnerability indices). This logic follows the general additive model used in many public health tools during the pandemic.
Examples
# Example 1: High Risk
# 70yo (+3), Male (+2), Diabetes (+1), HTN (+1), Nursing Home (+2)
# Score = 9
covid_risk_score(70, "male", 0, 0, 0, 0, 1, 1, 0, 0, 1)
# Example 2: Low Risk
# 30yo (0), Female (0), Asthma (+1)
# Score = 1
covid_risk_score(30, "female", 1, 0, 0, 0, 0, 0, 0, 0, 0)
Clinical Opiate Withdrawal Scale (COWS)
Description
Calculates the COWS score, an 11-item clinician-administered scale used to assess the severity of opiate withdrawal and monitor the response to treatment (e.g., buprenorphine induction). The score determines the level of physical dependence and withdrawal severity.
Usage
cows_opiate_withdrawal(pulse_score, sweating_score, restlessness_score,
pupil_size_score, bone_joint_ache_score,
runny_nose_tearing_score, gi_upset_score, tremor_score,
yawning_score, anxiety_irritability_score, gooseflesh_score)
Arguments
pulse_score |
Numeric. Score for Resting Pulse Rate. (0: <80, 1: 81-100, 2: 101-120, 4: >120). |
sweating_score |
Numeric. Score for Sweating. (0: None, 1: Subjective chills/flushing, 2: Flushed/moist face, 3: Beads of sweat, 4: Drenching sweat). |
restlessness_score |
Numeric. Score for Restlessness. (0: Able to sit still, 1: Difficulty sitting still, 3: Moving legs/arms often, 5: Unable to sit still). |
pupil_size_score |
Numeric. Score for Pupil Size. (0: Normal/Constricted, 1: Normal/Slightly large, 2: Moderate dilation, 5: Severe dilation). |
bone_joint_ache_score |
Numeric. Score for Bone/Joint Aches. (0: None, 1: Mild diffuse discomfort, 2: Severe aches/rubbing joints, 4: Rubbing joints/unable to sit still due to pain). |
runny_nose_tearing_score |
Numeric. Score for Runny Nose/Tearing. (0: None, 1: Stuffy nose/moist eyes, 2: Dripping nose/tearing, 4: Constant running/streaming). |
gi_upset_score |
Numeric. Score for GI Upset. (0: None, 1: Cramps, 2: Nausea/loose stool, 3: Vomiting/Diarrhea, 5: Multiple vomiting/diarrhea). |
tremor_score |
Numeric. Score for Tremor. (0: None, 1: Not visible/can be felt, 2: Visible/mild, 4: Gross/muscle twitching). |
yawning_score |
Numeric. Score for Yawning. (0: None, 1: 1-2 times, 2: Several times, 4: Frequent/several per minute). |
anxiety_irritability_score |
Numeric. Score for Anxiety/Irritability. (0: None, 1: Increasing irritability, 2: Obviously irritable/anxious, 4: Severe anxiety/mania). |
gooseflesh_score |
Numeric. Score for Gooseflesh skin. (0: None, 3: Pilnoerection perceptible to touch, 5: Prominent piloerection). |
Value
A list containing:
COWS_Score |
The calculated total score (Range 0-48). |
Severity_Category |
Interpretation: Mild (5-12), Moderate (13-24), Moderately Severe (25-36), Severe (>36). |
References
Wesson DR, Ling W. The Clinical Opiate Withdrawal Scale (COWS). J Psychoactive Drugs. 2003;35(2):253-259. doi:10.1080/02791072.2003.10400007
Examples
# Example 1: Moderate Withdrawal
# Pulse 105 (+2), Sweating (+2), Restless (+1), Aches (+1), GI (+2), Anxiety (+2), Others 0
# Total = 10 (Wait, sum is 10, which is Mild. Let's add Tremor +2, Yawning +1 -> Total 13)
cows_opiate_withdrawal(2, 2, 1, 0, 1, 0, 2, 2, 1, 2, 0)
# Example 2: Severe Withdrawal
# Pulse >120 (+4), Drenching Sweat (+4), Severe Restlessness (+5),
# Dilated Pupils (+5), Severe Aches (+4), Vomiting (+5), Tremor (+4),
# Frequent Yawning (+4), Severe Anxiety (+4), Gooseflesh (+5), Runny Nose (+4)
# Total = 48
cows_opiate_withdrawal(4, 4, 5, 5, 4, 4, 5, 4, 4, 4, 5)
CP-AKI Risk Calculator
Description
Calculates the Cisplatin-Associated Acute Kidney Injury (CP-AKI) Risk Score. This tool estimates the probability of developing acute kidney injury in patients undergoing treatment with intravenous cisplatin. The score incorporates patient demographics, vital signs, and laboratory values to stratify risk.
Usage
cp_aki_risk_score(age_ge_61, systolic_bp_gt_140, low_hemoglobin, low_albumin,
low_potassium, low_calcium, low_magnesium, high_creatinine_dose,
high_cisplatin_dose)
Arguments
age_ge_61 |
Numeric (0 or 1). Age >= 61 years. (1 = Yes, +1.5 points). |
systolic_bp_gt_140 |
Numeric (0 or 1). Systolic Blood Pressure > 140 mmHg. (1 = Yes, +1.5 points). |
low_hemoglobin |
Numeric (0 or 1). Hemoglobin (Male <= 13.4 g/dL; Female <= 12.4 g/dL). (1 = Yes, +1.0 point). |
low_albumin |
Numeric (0 or 1). Serum Albumin <= 3.9 g/dL. (1 = Yes, +2.5 points). |
low_potassium |
Numeric (0 or 1). Serum Potassium <= 4.0 mmol/L. (1 = Yes, +2.0 points). |
low_calcium |
Numeric (0 or 1). Serum Calcium <= 9.3 mg/dL. (1 = Yes, +1.5 points). |
low_magnesium |
Numeric (0 or 1). Serum Magnesium <= 1.8 mg/dL. (1 = Yes, +1.5 points). |
high_creatinine_dose |
Numeric (0 or 1). Dose of Cisplatin per Serum Creatinine level >= 60 mg/mg. (1 = Yes, +1.5 points). |
high_cisplatin_dose |
Numeric (0 or 1). Dose of Cisplatin >= 50 mg. (1 = Yes, +2.5 points). |
Value
A list containing:
CP_AKI_Score |
The calculated risk score (Range 0-15.5). |
Risk_Group |
Risk classification (Low, Moderate, High). |
Est_Risk_AKI |
Estimated probability of developing AKI. |
References
Motwani SS, et al. Development and Validation of a Risk Prediction Model for Acute Kidney Injury After the First Course of Cisplatin. J Clin Oncol. 2018.
Examples
# Example 1: High Risk
# Age 65 (+1.5), SBP 150 (+1.5), Low Alb (+2.5), High Cisplatin (+2.5)
# Score = 8.0
cp_aki_risk_score(1, 1, 0, 1, 0, 0, 0, 0, 1)
# Example 2: Low Risk
# Age 40 (0), Normal labs, Low Cisplatin Dose
# Score = 0
cp_aki_risk_score(0, 0, 0, 0, 0, 0, 0, 0, 0)
Cincinnati Prehospital Stroke Severity Scale (CP-SSS)
Description
Calculates the CP-SSS score to identify patients with suspected acute ischemic stroke who are at high risk for Large Vessel Occlusion (LVO). This tool helps EMS providers triage patients to the appropriate facility (e.g., Comprehensive Stroke Center for thrombectomy).
Usage
cp_sss_stroke_score(conjugate_gaze_deviation, severe_arm_weakness,
loc_questions_incorrect)
Arguments
conjugate_gaze_deviation |
Numeric (0 or 1). Presence of conjugate gaze deviation (eyes fixed to one side). (1 = Yes, +2 points). |
severe_arm_weakness |
Numeric (0 or 1). Presence of severe arm weakness (arm falls to bed before 10 seconds or cannot lift arm). (1 = Yes, +1 point). |
loc_questions_incorrect |
Numeric (0 or 1). Patient answers 1 or both Level of Consciousness questions incorrectly (Age and Month). (1 = Yes, +1 point). |
Value
A list containing:
CP_SSS_Score |
The calculated score (Range 0-4). |
LVO_Likelihood |
"High Likelihood" if Score >= 2, otherwise "Low Likelihood". |
Recommendation |
Triage guidance based on the score. |
References
Katz BS, McMullan JT, Sucharew H, Adeoye O, Broderick JP. Design and validation of a prehospital scale to predict severe stroke. Stroke. 2015;46(6):1508-1512. doi:10.1161/STROKEAHA.115.008804
Examples
# Example 1: High Probability of LVO
# Gaze deviation (+2), Severe Arm Weakness (+1), LOC intact
# Score = 3
cp_sss_stroke_score(1, 1, 0)
# Example 2: Low Probability
# Arm drift only (Severity 0 unless falls rapidly), LOC incorrect (+1)
# Score = 1
cp_sss_stroke_score(0, 0, 1)
Clinical Pulmonary Infection Score (CPIS) for VAP
Description
Calculates the Clinical Pulmonary Infection Score (CPIS) to assist in the diagnosis of Ventilator-Associated Pneumonia (VAP). The score evaluates six clinical, physiological, radiographic, and microbiological variables. A score greater than 6 typically correlates with the presence of VAP (sensitivity 77%, specificity 42%).
Usage
cpis_vap_score(temp_c, wbc_count, band_forms_present, tracheal_secretions,
pao2_fio2_ratio, ards_present, chest_xray, culture_results = 0)
Arguments
temp_c |
Numeric. Body temperature in degrees Celsius. 36.5 - 38.4: 0 pts. 38.5 - 38.9: 1 pt. < 36.5 or >= 39.0: 2 pts. |
wbc_count |
Numeric. White Blood Cell count (cells/mm3 or uL). 4,000 - 11,000: 0 pts. < 4,000 or > 11,000: 1 pt (unless bands present). |
band_forms_present |
Numeric (0 or 1). Presence of >= 500 band forms. (1 = Yes). If WBC is abnormal AND bands are present, score is 2 pts. |
tracheal_secretions |
Numeric (0, 1, or 2). 0: Rare / Absence of tracheal secretions. 1: Abundant tracheal secretions. 2: Abundant + Purulent tracheal secretions. |
pao2_fio2_ratio |
Numeric. PaO2/FiO2 ratio (mmHg). > 240: 0 pts. <= 240: 2 pts (Only if ARDS is NOT present). |
ards_present |
Numeric (0 or 1). Presence of ARDS (Acute Respiratory Distress Syndrome). (1 = Yes). If ARDS is present, the oxygenation score is 0 regardless of the P/F ratio. |
chest_xray |
Numeric (0, 1, or 2). Chest radiograph findings. 0: No infiltrate. 1: Diffuse or patchy infiltrate. 2: Localized infiltrate. |
culture_results |
Numeric (0, 1, or 2). Culture of tracheal aspirate. Defaults to 0 if not yet available. 0: Negative or rare growth. 1: Pathogenic bacteria cultured (moderate/heavy). 2: Pathogenic bacteria cultured (moderate/heavy) + Same bacteria on Gram stain. |
Value
A list containing:
CPIS_Score |
The calculated total score (Range 0-12). |
Interpretation |
Clinical suggestion ("Suggestive of VAP" if Score > 6). |
References
Pugin J, Auckenthaler R, Mili N, et al. Diagnosis of ventilator-associated pneumonia by bacteriologic analysis of bronchoscopic and nonbronchoscopic "blind" bronchoalveolar lavage fluid. Am Rev Respir Dis. 1991;143(5 Pt 1):1121-1129. doi:10.1164/ajrccm/143.5_Pt_1.1121
Examples
# Example 1: Suggestive of VAP
# Temp 39.0 (+2), WBC 15k with Bands (+2), Purulent Secretions (+2),
# PF 200 No ARDS (+2), Localized CXR (+2), Culture Pending (0)
# Score = 10
cpis_vap_score(39.0, 15000, 1, 2, 200, 0, 2, 0)
# Example 2: Low Likelihood
# Temp 37.0 (0), WBC 8000 (0), Rare secretions (0), PF 300 (0), Diffuse CXR (1)
# Score = 1
cpis_vap_score(37.0, 8000, 0, 0, 300, 0, 1, 0)
Critical Care Pain Observation Tool (CPOT)
Description
Calculates the CPOT score, a behavioral pain assessment tool for critically ill adults who cannot self-report (e.g., sedated or intubated patients). The scale evaluates four domains: Facial Expression, Body Movements, Muscle Tension, and Compliance with Ventilator (or Vocalization for non-intubated patients). A score greater than 2 indicates significant pain.
Usage
cpot_pain_score(facial_expression, body_movements, muscle_tension,
compliance_or_vocalization)
Arguments
facial_expression |
Numeric (0-2). 0: Relaxed/Neutral. 1: Tense (Frowning, brow lowering). 2: Grimacing (Tight eyelids). |
body_movements |
Numeric (0-2). 0: Absence of movements. 1: Protection (Slow, cautious movements, touching painful site). 2: Restlessness (Thrashing, pulling at tubes). |
muscle_tension |
Numeric (0-2). Assessed by passive flexion/extension of the arm. 0: Relaxed. 1: Tense/Rigid (Resistance to passive movement). 2: Very Tense/Rigid (Strong resistance). |
compliance_or_vocalization |
Numeric (0-2). If Intubated: 0: Tolerating ventilator (No alarms). 1: Coughing but tolerating (Alarms stop spontaneously). 2: Fighting ventilator (Asynchrony). If Extubated: 0: Normal talk/No sound. 1: Sighing/Moaning. 2: Crying/Sobbing. |
Value
A list containing:
CPOT_Score |
The calculated total score (Range 0-8). |
Interpretation |
Clinical guidance ("Positive for Pain" if Score > 2). |
References
Gélinas C, Fillion L, Puntillo KA, Viens C, Fortier M. Validation of the critical-care pain observation tool in adult patients. Am J Crit Care. 2006;15(4):420-427.
Examples
# Example 1: Significant Pain
# Grimacing (2), Restless (2), Tense (1), Fighting vent (2)
# Score = 7
cpot_pain_score(2, 2, 1, 2)
# Example 2: No Pain
# Relaxed (0), No movement (0), Relaxed muscles (0), Tolerating vent (0)
# Score = 0
cpot_pain_score(0, 0, 0, 0)
CRAFFT Questionnaire for Adolescent Substance Abuse
Description
Calculates the CRAFFT screening score to identify substance use problems in adolescents (age 12-21). The tool consists of three opening questions regarding use of alcohol, marijuana, or other drugs in the past 12 months. If any are positive, six further questions (Car, Relax, Alone, Forget, Friends, Trouble) are asked. If the opening questions are negative, only the 'Car' question is asked.
Usage
crafft_screening_tool(drink_alcohol, smoke_marijuana, use_other_drugs,
car_driven_by_high, relax_use, alone_use, forget_things,
friends_family_advice, trouble_while_using)
Arguments
drink_alcohol |
Numeric (0 or 1). During the past 12 months, did you drink any alcohol (more than a few sips)? (1 = Yes). |
smoke_marijuana |
Numeric (0 or 1). During the past 12 months, did you smoke any marijuana or hashish? (1 = Yes). |
use_other_drugs |
Numeric (0 or 1). During the past 12 months, did you use anything else to get high? (1 = Yes). |
car_driven_by_high |
Numeric (0 or 1). Have you ever ridden in a CAR driven by someone (including yourself) who was "high" or had been using alcohol or drugs? (1 = Yes). |
relax_use |
Numeric (0 or 1). Do you ever use alcohol or drugs to RELAX, feel better about yourself, or fit in? (1 = Yes). |
alone_use |
Numeric (0 or 1). Do you ever use alcohol or drugs while you are by yourself, or ALONE? (1 = Yes). |
forget_things |
Numeric (0 or 1). Do you ever FORGET things you did while using alcohol or drugs? (1 = Yes). |
friends_family_advice |
Numeric (0 or 1). Do your family or FRIENDS ever tell you that you should cut down on your drinking or drug use? (1 = Yes). |
trouble_while_using |
Numeric (0 or 1). Have you ever gotten into TROUBLE while you were using alcohol or drugs? (1 = Yes). |
Value
A list containing:
CRAFFT_Score |
The calculated total score (Range 0-6). |
Screening_Result |
Interpretation of the score (Positive >= 2). |
Recommendation |
Clinical guidance based on the result. |
References
Knight JR, Shrier LA, Bravender TD, et al. A new brief screen for adolescent substance abuse. Arch Pediatr Adolesc Med. 1999;153(6):591-596. doi:10.1001/archpedi.153.6.591
Examples
# Example 1: Positive Screen
# Alcohol use (1), Car (1), Friends (1) -> Score 2
crafft_screening_tool(1, 0, 0, 1, 0, 0, 0, 1, 0)
# Example 2: Negative Screen (No substance use in past year)
# No alcohol/drugs, Car question asked (0) -> Score 0
crafft_screening_tool(0, 0, 0, 0, 0, 0, 0, 0, 0)
CRASH Score (Chemotherapy Risk Assessment Scale for High-Age Patients)
Description
Calculates the CRASH score to stratify the risk of severe chemotoxicity in patients aged 70 years or older. The tool generates two separate risk scores: one for Grade 4 Hematologic toxicity and one for Grade 3/4 Non-hematologic toxicity. It utilizes geriatric assessment variables (IADL, MMSE, MNA), clinical status (BP, ECOG, LDH), and the chemotherapeutic regimen risk (MAX2 index).
Usage
crash_chemo_toxicity_score(diastolic_bp, iadl_score, ldh_elevated,
chemo_risk_max2, ecog_ps, mmse_score, mna_score)
Arguments
diastolic_bp |
Numeric. Diastolic blood pressure in mmHg. (<= 72 mmHg adds 2 points to Hematologic score). |
iadl_score |
Numeric. Instrumental Activities of Daily Living (IADL) score (OARS scale, 0-28). (< 28 adds 2 points to Hematologic score). |
ldh_elevated |
Numeric (0 or 1). Is Lactate Dehydrogenase (LDH) elevated above normal? (1 = Yes, +2 points to Hematologic score). |
chemo_risk_max2 |
String. Chemotherapy regimen risk based on MAX2 index. Options: "low", "intermediate", "high". (Adds points to both scores: Hema [0/1/1], Non-Hema [0/2/4]). |
ecog_ps |
Numeric (0-4). ECOG Performance Status. (1-2 adds 1 pt, 3-4 adds 2 pts to Non-Hema score). |
mmse_score |
Numeric. Mini-Mental State Examination score (0-30). (< 30 adds 1 point to Non-Hema score). |
mna_score |
Numeric. Mini Nutritional Assessment score (0-30). (< 28 adds 2 points to Non-Hema score). |
Value
A list containing:
Scores |
Breakdown of Hematologic, Non-Hematologic, and Combined scores. |
Hematologic_Toxicity_Risk |
Risk category and estimated rate of Grade 4 hematologic toxicity. |
Non_Hematologic_Toxicity_Risk |
Risk category and estimated rate of Grade 3/4 non-hematologic toxicity. |
References
Extermann M, Boler I, Reich RR, et al. Predicting the risk of chemotherapy toxicity in older patients: the Chemotherapy Risk Assessment Scale for High-Age Patients (CRASH) score. Cancer. 2012;118(13):3377-3386. doi:10.1002/cncr.26646
Examples
# Example 1: High Risk Patient
# DBP 70 (+2), IADL 25 (+2), LDH High (+2), Chemo High (+1 Hema, +4 Non-Hema)
# ECOG 1 (+1), MMSE 29 (+1), MNA 25 (+2)
# Hema Score: 2+2+2+1 = 7 (High Risk)
# Non-Hema Score: 1+1+2+4 = 8 (High Risk)
crash_chemo_toxicity_score(70, 25, 1, "high", 1, 29, 25)
# Example 2: Low Risk Patient
# DBP 80 (0), IADL 28 (0), LDH Normal (0), Chemo Low (0)
# ECOG 0 (0), MMSE 30 (0), MNA 30 (0)
# Hema Score: 0, Non-Hema Score: 0
crash_chemo_toxicity_score(80, 28, 0, "low", 0, 30, 30)
CRB-65 Score for Pneumonia Severity
Description
Calculates the CRB-65 score to stratify the severity of community-acquired pneumonia (CAP). Unlike the CURB-65 score, CRB-65 does not require blood urea nitrogen (BUN) measurement, making it suitable for use in primary care or settings without immediate laboratory access.
Usage
crb65_pneumonia_severity(confusion, respiratory_rate, systolic_bp,
diastolic_bp, age)
Arguments
confusion |
Numeric (0 or 1). Recent confusion. (1 = Yes, +1 point). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. (>= 30 bpm adds +1 point). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. (< 90 mmHg contributes to the BP criterion). |
diastolic_bp |
Numeric. Diastolic blood pressure in mmHg. (<= 60 mmHg contributes to the BP criterion). Note: The BP criterion is met if SBP < 90 OR DBP <= 60 (+1 point). |
age |
Numeric. Patient age in years. (>= 65 years adds +1 point). |
Value
A list containing:
CRB65_Score |
The calculated score (Range 0-4). |
Risk_Level |
Classification (Very Low, Increased, High). |
Est_Mortality_30_Day |
Estimated mortality percentage. |
Recommendation |
Guidance on disposition (Home vs. Hospital). |
References
Lim WS, van der Eerden MM, Laing R, et al. Defining community acquired pneumonia severity on presentation to hospital: an international derivation and validation study. Thorax. 2003;58(5):377-382. doi:10.1136/thorax.58.5.377
Examples
# Example 1: High Risk
# 70yo (+1), Confused (+1), RR 32 (+1), BP 100/70 (0)
# Score = 3
crb65_pneumonia_severity(1, 32, 100, 70, 70)
# Example 2: Low Risk
# 40yo (0), Not confused (0), RR 18 (0), BP 120/80 (0)
# Score = 0
crb65_pneumonia_severity(0, 18, 120, 80, 40)
CRUSADE Score for Post-MI Bleeding Risk
Description
Calculates the CRUSADE Bleeding Score to stratify the risk of in-hospital major bleeding in patients with NSTEMI (Non-ST-Elevation Myocardial Infarction). The score helps guide the choice and dosing of antithrombotic therapies to balance ischemic benefit against bleeding risk.
Usage
crusade_bleeding_score(hematocrit_percent, creatinine_clearance, heart_rate,
sex, chf_signs, prior_vascular_disease, diabetes,
systolic_bp)
Arguments
hematocrit_percent |
Numeric. Baseline hematocrit level (%). <31: +9 pts. 31-33.9: +7 pts. 34-36.9: +3 pts. 37-39.9: +2 pts. >=40: 0 pts. |
creatinine_clearance |
Numeric. Creatinine clearance in mL/min (typically calculated via Cockcroft-Gault). <=15: +39 pts. >15-30: +35 pts. >30-60: +28 pts. >60-90: +17 pts. >90-120: +7 pts. >120: 0 pts. |
heart_rate |
Numeric. Heart rate at presentation (bpm). <=70: 0 pts. 71-80: +1 pt. 81-90: +3 pts. 91-100: +6 pts. 101-110: +8 pts. 111-120: +10 pts. >=121: +11 pts. |
sex |
String. "Male" (0 pts) or "Female" (+8 pts). |
chf_signs |
Numeric (0 or 1). Signs of Congestive Heart Failure at presentation. (1 = Yes, +7 pts). |
prior_vascular_disease |
Numeric (0 or 1). History of prior vascular disease (e.g., PAD, Stroke). (1 = Yes, +6 pts). |
diabetes |
Numeric (0 or 1). History of Diabetes Mellitus. (1 = Yes, +6 pts). |
systolic_bp |
Numeric. Systolic Blood Pressure at presentation (mmHg). <=90: +10 pts. 91-100: +8 pts. 101-120: +5 pts. 121-180: +1 pt. 181-200: +3 pts. >=201: +5 pts. |
Value
A list containing:
CRUSADE_Score |
The calculated total score (Range 0-96). |
Risk_Category |
Classification (Very Low, Low, Moderate, High, Very High). |
In_Hospital_Major_Bleeding_Risk |
Estimated percentage probability of major bleeding. |
References
Subherwal S, Bach RG, Chen AY, et al. Baseline risk of major bleeding in non-ST-segment elevation myocardial infarction: the CRUSADE Bleeding Score. Circulation. 2009;119(14):1873-1882. doi:10.1161/CIRCULATIONAHA.108.828541
Examples
# Example 1: High Risk
# Hct 28 (+9), CrCl 25 (+35), HR 115 (+10), Female (+8), SBP 100 (+8), No other factors
# Score = 70
crusade_bleeding_score(28, 25, 115, "female", 0, 0, 0, 100)
# Example 2: Low Risk
# Hct 42 (0), CrCl 100 (+7), HR 70 (0), Male (0), SBP 130 (+1), No other factors
# Score = 8
crusade_bleeding_score(42, 100, 70, "male", 0, 0, 0, 130)
Cryoprecipitate Dosing for Fibrinogen Replacement
Description
Calculates the number of cryoprecipitate units required to raise a patient's serum fibrinogen level to a specified target. The calculation estimates the patient's plasma volume based on weight and hematocrit, determines the total fibrinogen deficit, and divides by the average fibrinogen content per unit of cryoprecipitate.
Usage
cryoprecipitate_dosing(current_fibrinogen, target_fibrinogen, weight_kg,
hematocrit, fibrinogen_per_unit_mg = 250)
Arguments
current_fibrinogen |
Numeric. Current serum fibrinogen level in mg/dL. |
target_fibrinogen |
Numeric. Desired serum fibrinogen level in mg/dL (typically 100-150 mg/dL depending on clinical scenario). |
weight_kg |
Numeric. Patient weight in kilograms. |
hematocrit |
Numeric. Patient hematocrit percentage (e.g., 40 for 40%). Used to estimate plasma volume. |
fibrinogen_per_unit_mg |
Numeric. The estimated amount of fibrinogen in a single unit of cryoprecipitate. Defaults to 250 mg (common range 200-250 mg, but can vary by blood bank). |
Value
A list containing:
Estimated_Units |
The calculated number of units needed, rounded up to the nearest whole unit. |
Exact_Units_Calculation |
The raw calculated dosage value. |
Total_Fibrinogen_Required_mg |
The total milligrams of fibrinogen required to meet the deficit. |
Plasma_Volume_dL |
The estimated plasma volume used in the calculation. |
References
Nickson C. Cryoprecipitate. Life in the Fast Lane (LITFL). 2020. Guidelines for the use of fresh-frozen plasma, cryoprecipitate and cryosupernatant. British Committee for Standards in Haematology. Br J Haematol. 2004;126(1):11-28.
Examples
# Example 1: 70kg patient, Hct 40, Fib 50, Target 100
# TBV = 4900 mL, PV = 2940 mL (29.4 dL)
# Deficit = 50 mg/dL * 29.4 dL = 1470 mg
# Units (at 250mg/unit) = 5.88 -> 6 Units
cryoprecipitate_dosing(50, 100, 70, 40)
# Example 2: 80kg patient, Hct 30, Fib 100, Target 150 (Higher target)
cryoprecipitate_dosing(100, 150, 80, 30)
CSHA Clinical Frailty Scale (CFS)
Description
Retrieves the category and description for the Clinical Frailty Scale (CFS), developed by the Canadian Study of Health and Aging (CSHA). The scale assigns a score from 1 to 9 to summarize the overall level of fitness or frailty of an older adult after a comprehensive clinical evaluation.
Usage
csha_clinical_frailty_scale(cfs_level)
Arguments
cfs_level |
Numeric (1-9). The selected frailty level based on clinical judgment. 1: Very Fit 2: Well 3: Managing Well 4: Vulnerable 5: Mildly Frail 6: Moderately Frail 7: Severely Frail 8: Very Severely Frail 9: Terminally Ill |
Value
A list containing:
CFS_Level |
The input level. |
Category |
The short title of the frailty stage. |
Description |
The detailed clinical description defining the stage. |
References
Rockwood K, Song X, MacKnight C, et al. A global clinical measure of fitness and frailty in elderly people. CMAJ. 2005;173(5):489-495. doi:10.1503/cmaj.050051
Examples
# Example 1: Managing Well
csha_clinical_frailty_scale(3)
# Example 2: Moderately Frail
csha_clinical_frailty_scale(6)
Columbia-Suicide Severity Rating Scale (C-SSRS) Screener
Description
Calculates the risk stratification based on the C-SSRS Screener (Recent). This tool assesses the severity of suicidal ideation (1-5) and the presence of recent suicidal behavior to triage patients into Low, Moderate, or High risk categories for self-harm.
Usage
cssrs_screener(wish_to_be_dead, suicidal_thoughts, thoughts_with_method,
intent_without_plan, intent_with_plan, suicidal_behavior_3mo)
Arguments
wish_to_be_dead |
Numeric (0 or 1). Q1: Have you wished you were dead or wished you could go to sleep and not wake up? (1 = Yes). |
suicidal_thoughts |
Numeric (0 or 1). Q2: Have you actually had any thoughts of killing yourself? (1 = Yes). |
thoughts_with_method |
Numeric (0 or 1). Q3: Have you been thinking about how you might do this? (1 = Yes). |
intent_without_plan |
Numeric (0 or 1). Q4: Have you had these thoughts and had some intention of acting on them? (1 = Yes). |
intent_with_plan |
Numeric (0 or 1). Q5: Have you started to work out or worked out the details of how to kill yourself? Do you intend to carry out this plan? (1 = Yes). |
suicidal_behavior_3mo |
Numeric (0 or 1). Q6: Have you done anything, started to do anything, or prepared to do anything to end your life in the past 3 months? (1 = Yes). |
Value
A list containing:
Risk_Level |
The determined risk category (None, Low, Moderate, High). |
Triage_Color |
Corresponding triage color (Green, Yellow, Orange, Red). |
Recommended_Action |
Clinical guidance for safety/observation based on risk. |
Max_Ideation_Severity |
The highest level of ideation endorsed (0-5). |
References
Posner K, Brown GK, Stanley B, et al. The Columbia-Suicide Severity Rating Scale: initial validity and internal consistency findings from three multisite studies with adolescents and adults. Am J Psychiatry. 2011;168(12):1266-1277. doi:10.1176/appi.ajp.2011.10111704
Examples
# Example 1: High Risk (Intent with Plan)
# Q1-Q5 Yes, No recent behavior
cssrs_screener(1, 1, 1, 1, 1, 0)
# Example 2: Low Risk (Wish to be dead only)
# Q1 Yes, others No
cssrs_screener(1, 0, 0, 0, 0, 0)
Common Terminology Criteria for Adverse Events (CTCAE) v5.0
Description
Provides definitions for the general grading scale (1-5) of the CTCAE v5.0 and calculates specific grades for common hematologic toxicities (Neutropenia and Thrombocytopenia) based on laboratory values. The CTCAE is the standard system for reporting the severity of adverse events in cancer therapy.
Usage
ctcae_v5_grading(grade_index = NULL, anc_count = NULL, platelet_count = NULL)
Arguments
grade_index |
Numeric (1-5) (Optional). If provided, returns the general definition for that specific severity grade. |
anc_count |
Numeric (Optional). Absolute Neutrophil Count in cells/mm3. If provided, calculates the specific CTCAE grade for Neutropenia. |
platelet_count |
Numeric (Optional). Platelet count in cells/mm3. If provided, calculates the specific CTCAE grade for Thrombocytopenia. |
Value
A list containing:
Grade |
The grade queried or calculated. |
General_Definition |
The general description of severity (if grade_index is used). |
Toxicity |
The specific toxicity evaluated (if lab values used). |
Calculated_Grade |
The determined grade based on v5.0 thresholds. |
References
Common Terminology Criteria for Adverse Events (CTCAE) Version 5.0. US Department of Health and Human Services, National Institutes of Health, National Cancer Institute. Published November 27, 2017.
Examples
# Example 1: Get definition for Grade 3
ctcae_v5_grading(grade_index = 3)
# Example 2: Calculate Grade for Neutropenia
# ANC 800 (Grade 3: 500 - <1000)
ctcae_v5_grading(anc_count = 800)
# Example 3: Calculate Grade for Thrombocytopenia
# Platelets 30,000 (Grade 3: 25,000 - <50,000)
ctcae_v5_grading(platelet_count = 30000)
Carpal Tunnel Syndrome 6 (CTS-6)
Description
Calculates the CTS-6 score, a validated clinical diagnostic tool for Carpal Tunnel Syndrome. The score assigns weighted points to six history and physical examination findings to estimate the probability of CTS. A score of 12 or higher indicates a high probability of CTS.
Usage
cts6_score(numbness_median_territory, nocturnal_numbness,
thenar_atrophy_weakness, phalens_test, tinels_sign,
two_point_discrim_gt_5mm)
Arguments
numbness_median_territory |
Numeric (0 or 1). Numbness primarily in the median nerve distribution (thumb, index, middle, radial half of ring finger). (1 = Yes, +3.5 points). |
nocturnal_numbness |
Numeric (0 or 1). Numbness waking the patient at night. (1 = Yes, +4.0 points). |
thenar_atrophy_weakness |
Numeric (0 or 1). Observation of thenar atrophy or weakness of thumb abduction. (1 = Yes, +5.0 points). |
phalens_test |
Numeric (0 or 1). Positive Phalen's test (numbness/tingling within 60 seconds of wrist flexion). (1 = Yes, +5.0 points). |
tinels_sign |
Numeric (0 or 1). Positive Tinel's sign (tingling/shock sensation on tapping median nerve). (1 = Yes, +4.0 points). |
two_point_discrim_gt_5mm |
Numeric (0 or 1). Two-point discrimination > 5 mm in the median nerve distribution. (1 = Yes, +4.5 points). |
Value
A list containing:
CTS6_Score |
The calculated total score (Range 0-26). |
Probability_Category |
Estimated probability of CTS (Low <5, Intermediate 5-12, High >12). |
References
Atroshi I, Lyren PE, Gummesson C. The 6-item CTS symptoms scale: a brief outcomes measure for carpal tunnel syndrome. J Hand Surg Am. 2009;34(2):196-204. Graham B. The value added by electrodiagnostic testing in the diagnosis of carpal tunnel syndrome. J Bone Joint Surg Am. 2008;90(12):2587-2593.
Examples
# Example 1: High Probability
# Numbness median (+3.5), Nocturnal (+4), Phalen's (+5)
# Score = 12.5
cts6_score(1, 1, 0, 1, 0, 0)
# Example 2: Low Probability
# Only Tinel's sign present
# Score = 4.0
cts6_score(0, 0, 0, 0, 1, 0)
CURB-65 Score for Pneumonia Severity
Description
Calculates the CURB-65 score to estimate mortality risk in patients with community-acquired pneumonia. The score assesses Confusion, Urea (BUN), Respiratory rate, Blood pressure, and age >= 65.
Usage
curb65_pneumonia_severity(confusion, bun, respiratory_rate, systolic_bp,
diastolic_bp, age, bun_units = "mg/dL")
Arguments
confusion |
Numeric (0 or 1). Presence of confusion (1 = Yes). |
bun |
Numeric. Blood Urea Nitrogen level. (> 19 mg/dL or > 7 mmol/L adds 1 point). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. (>= 30 adds 1 point). |
systolic_bp |
Numeric. Systolic blood pressure. (< 90 mmHg contributes to BP criterion). |
diastolic_bp |
Numeric. Diastolic blood pressure. (<= 60 mmHg contributes to BP criterion). Note: The BP point is added if SBP < 90 OR DBP <= 60. |
age |
Numeric. Patient age in years. (>= 65 adds 1 point). |
bun_units |
String. Units for BUN. "mg/dL" (default) or "mmol/L". |
Value
A list containing:
CURB65_Score |
The calculated score (Range 0-5). |
Risk_Group |
Risk classification (Low, Moderate, High). |
Est_30_Day_Mortality |
Estimated 30-day mortality percentage. |
Recommendation |
Clinical guidance regarding disposition (Home vs. Hospital vs. ICU). |
References
Lim WS, van der Eerden MM, Laing R, et al. Defining community acquired pneumonia severity on presentation to hospital: an international derivation and validation study. Thorax. 2003;58(5):377-382. doi:10.1136/thorax.58.5.377
Examples
# Example 1: High Risk
# 70yo (+1), Confused (+1), BUN 25 (+1), SBP 85 (+1), RR 20
# Score = 4
curb65_pneumonia_severity(1, 25, 20, 85, 60, 70)
# Example 2: Low Risk
# 50yo, Alert, BUN 10, RR 18, BP 120/80
# Score = 0
curb65_pneumonia_severity(0, 10, 18, 120, 80, 50)
Cytokine Release Syndrome (CRS) Grading (ASTCT 2019)
Description
Calculates the grade of Cytokine Release Syndrome (CRS) according to the 2019 American Society for Transplantation and Cellular Therapy (ASTCT) consensus grading system. This system is used to assess the severity of CRS in patients receiving immune effector cell therapies (e.g., CAR-T cells).
Usage
cytokine_release_syndrome_grading(temperature_c, hypotension_present,
hypotension_management, hypoxia_present,
hypoxia_management)
Arguments
temperature_c |
Numeric. Patient temperature in degrees Celsius. Fever (>= 38.0 C) is a prerequisite for CRS diagnosis. |
hypotension_present |
Numeric (0 or 1). Presence of hypotension. (1 = Yes). |
hypotension_management |
String. Management required for hypotension. Options: "none", "fluids", "low_dose_vasopressor" (e.g., one pressor), "high_dose_vasopressor" (e.g., multiple pressors). |
hypoxia_present |
Numeric (0 or 1). Presence of hypoxia (SpO2 < 93% on room air). (1 = Yes). |
hypoxia_management |
String. Management required for hypoxia. Options: "none", "low_flow_o2" (<6L/min NC), "high_flow_o2" (>=6L/min NC, mask), "positive_pressure" (CPAP, BiPAP, Mechanical Ventilation). |
Value
A list containing:
CRS_Grade |
The calculated CRS Grade (0-4). |
Description |
The clinical definition of the assigned grade. |
References
Lee DW, Santomasso BD, Locke FL, et al. ASTCT Consensus Grading for Cytokine Release Syndrome and Neurologic Toxicity Associated with Immune Effector Cells. Biol Blood Marrow Transplant. 2019;25(4):625-638. doi:10.1016/j.bbmt.2018.12.758
Examples
# Example 1: Grade 2 CRS
# Fever 38.5, Hypotension responding to fluids, No hypoxia
cytokine_release_syndrome_grading(38.5, 1, "fluids", 0, "none")
# Example 2: Grade 3 CRS
# Fever 39.0, Hypotension on Norepi, Hypoxia on High Flow O2
cytokine_release_syndrome_grading(39.0, 1, "low_dose_vasopressor", 1, "high_flow_o2")
D'Amico Risk Classification for Prostate Cancer
Description
Calculates the D'Amico Risk Classification for prostate cancer. This system stratifies patients into Low, Intermediate, or High risk of biochemical recurrence following localized treatment (surgery or radiation) based on PSA level, Gleason score, and Clinical T stage.
Usage
damico_prostate_risk(psa, gleason_score, clinical_t_stage)
Arguments
psa |
Numeric. Prostate-Specific Antigen level in ng/mL. |
gleason_score |
Numeric. Total Gleason Score (sum of primary and secondary patterns). |
clinical_t_stage |
String. Clinical Tumor (T) Stage. Accepted values: "t1", "t1a", "t1b", "t1c", "t2a", "t2b", "t2c", "t3", "t3a", "t3b", "t4". |
Value
A list containing:
Risk_Classification |
The determined risk group: "Low Risk": PSA < 10 AND Gleason <= 6 AND T-stage T1-T2a. "Intermediate Risk": PSA 10-20 OR Gleason 7 OR T-stage T2b. "High Risk": PSA > 20 OR Gleason >= 8 OR T-stage >= T2c. |
References
D'Amico AV, Whittington R, Malkowicz SB, et al. Biochemical outcome after radical prostatectomy, external beam radiation therapy, or interstitial radiation therapy for clinically localized prostate cancer. JAMA. 1998;280(11):969-974. doi:10.1001/jama.280.11.969
Examples
# Example 1: High Risk
# PSA 8 (Low), Gleason 8 (High), T2a (Low)
# Result = High Risk
damico_prostate_risk(8, 8, "t2a")
# Example 2: Low Risk
# PSA 5, Gleason 6, T1c
# Result = Low Risk
damico_prostate_risk(5, 6, "t1c")
Danger Assessment Tool
Description
Calculates the Danger Assessment score to determine the level of danger and risk of homicide in abusive relationships. The score is a weighted sum of 20 risk factors (though standardized simplified versions may use 19 weighted inputs).
Usage
danger_assessment_tool(increase_severity, gun_in_house, partner_unemployed,
weapon_used, threat_to_kill, spy_on_partner,
forced_sex, choking, alcohol_abuse, drug_use,
violent_jealousy, controlling_behavior,
beaten_while_pregnant, stepchild_in_home,
threaten_children, partner_suicide_threat,
arrest_record, left_or_separated, capable_of_killing)
Arguments
increase_severity |
Numeric (0 or 1). Has the physical violence increased in severity or frequency over the past year? (1 = Yes, +3). |
gun_in_house |
Numeric (0 or 1). Does he own a gun? (1 = Yes, +3). |
partner_unemployed |
Numeric (0 or 1). Is he unemployed? (1 = Yes, +4). |
weapon_used |
Numeric (0 or 1). Has he ever used a weapon against you or threatened you with a lethal weapon? (1 = Yes, +3). |
threat_to_kill |
Numeric (0 or 1). Does he threaten to kill you? (1 = Yes, +3). |
spy_on_partner |
Numeric (0 or 1). Does he follow or spy on you, leave threatening notes/messages, destroy property, or call when you don't want him to? (1 = Yes, +2). |
forced_sex |
Numeric (0 or 1). Have you ever been forced to have sex when you didn't want to? (1 = Yes, +3). |
choking |
Numeric (0 or 1). Has he ever tried to choke you? (1 = Yes, +3). |
alcohol_abuse |
Numeric (0 or 1). Is he an alcoholic or problem drinker? (1 = Yes, +1). |
drug_use |
Numeric (0 or 1). Does he use illegal drugs? (1 = Yes, +1). |
violent_jealousy |
Numeric (0 or 1). Is he violently or constantly jealous? (1 = Yes, +1). |
controlling_behavior |
Numeric (0 or 1). Does he try to control most of your daily activities? (1 = Yes, +1). |
beaten_while_pregnant |
Numeric (0 or 1). Have you ever been beaten while you were pregnant? (1 = Yes, +1). |
stepchild_in_home |
Numeric (0 or 1). Is there a stepchild in the home? (1 = Yes, +2). |
threaten_children |
Numeric (0 or 1). Does he threaten to harm your children? (1 = Yes, +1). |
partner_suicide_threat |
Numeric (0 or 1). Has he ever threatened or tried to commit suicide? (1 = Yes, +1). |
arrest_record |
Numeric (0 or 1). Has he ever been arrested for domestic violence? (1 = Yes, +1). |
left_or_separated |
Numeric (0 or 1). Did you leave him after living together during the past year? (1 = Yes, +4). |
capable_of_killing |
Numeric (0 or 1). Do you believe he is capable of killing you? (1 = Yes, +3). |
Value
A list containing:
DA_Score |
The total weighted risk score. |
Risk_Level |
Classification (Variable, Increased, Severe, Extreme Danger). |
References
Campbell JC, Webster DW, Koziol-McLain J, et al. Risk factors for femicide in abusive relationships: results from a multisite case control study. Am J Public Health. 2003;93(7):1089-1097. doi:10.2105/ajph.93.7.1089
Examples
# Example 1: Extreme Danger
# Unemployed, Gun, Left him, Choked, Forced Sex
# Score = 4 + 3 + 4 + 3 + 3 = 17 (Severe/Extreme border)
danger_assessment_tool(0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0)
# Example 2: Variable Danger
# Jealousy, Control, Alcohol
# Score = 1 + 1 + 1 = 3
danger_assessment_tool(0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0)
Dual Antiplatelet Therapy (DAPT) Score
Description
Calculates the DAPT Score to guide the duration of dual antiplatelet therapy (DAPT) after coronary stent implantation. The score balances the risks of ischemia (stent thrombosis, MI) against the risks of bleeding to determine if prolonged therapy (>12 months) is beneficial.
Usage
dapt_score(age, smoker, diabetes, mi_presentation, prior_pci_mi,
paclitaxel_stent, stent_diameter_lt_3mm, chf_lvef_lt_30,
vein_graft_stent)
Arguments
age |
Numeric. Patient age in years. >= 75: -2 pts. 65-74: -1 pt. < 65: 0 pts. |
smoker |
Numeric (0 or 1). Current cigarette smoker. (1 = Yes, +1 pt). |
diabetes |
Numeric (0 or 1). Diabetes mellitus. (1 = Yes, +1 pt). |
mi_presentation |
Numeric (0 or 1). MI at presentation. (1 = Yes, +1 pt). |
prior_pci_mi |
Numeric (0 or 1). Prior PCI or prior MI. (1 = Yes, +1 pt). |
paclitaxel_stent |
Numeric (0 or 1). Paclitaxel-eluting stent used. (1 = Yes, +1 pt). |
stent_diameter_lt_3mm |
Numeric (0 or 1). Stent diameter < 3 mm. (1 = Yes, +1 pt). |
chf_lvef_lt_30 |
Numeric (0 or 1). Congestive heart failure or LVEF < 30%. (1 = Yes, +2 pts). |
vein_graft_stent |
Numeric (0 or 1). Vein graft stent. (1 = Yes, +2 pts). |
Value
A list containing:
DAPT_Score |
The calculated score (Range -2 to 10). |
Risk_Profile |
"Low Score" (<2) or "High Score" (>=2). |
Recommendation |
Clinical guidance regarding DAPT duration (Standard vs. Prolonged). |
References
Yeh RW, Secemsky EA, Kereiakes DJ, et al. Development and Validation of a Prediction Rule for Benefit and Harm of Dual Antiplatelet Therapy Beyond 1 Year After Percutaneous Coronary Intervention. JAMA. 2016;315(16):1735-1749. doi:10.1001/jama.2016.3775
Examples
# Example 1: Prolonged DAPT Candidate
# 55yo (0), Smoker (+1), MI at presentation (+1), Diabetes (+1)
# Score = 3
dapt_score(55, 1, 1, 1, 0, 0, 0, 0, 0)
# Example 2: Standard DAPT Candidate
# 70yo (-1), Prior MI (+1), No other factors
# Score = 0
dapt_score(70, 0, 0, 0, 1, 0, 0, 0, 0)
Disease Activity Score-28 for Rheumatoid Arthritis (DAS28-CRP)
Description
Calculates the DAS28-CRP score, a standardized index of disease activity in Rheumatoid Arthritis. The score is calculated using the tender joint count (28 joints), swollen joint count (28 joints), C-Reactive Protein (CRP) level, and the patient's global assessment of health. It stratifies patients into Remission, Low, Moderate, or High disease activity.
Usage
das28_crp_rheumatoid_arthritis(tender_joint_count, swollen_joint_count, crp,
patient_global_health, crp_units = "mg/L")
Arguments
tender_joint_count |
Numeric (0-28). Number of tender joints identified during examination. |
swollen_joint_count |
Numeric (0-28). Number of swollen joints identified during examination. |
crp |
Numeric. C-Reactive Protein level. |
patient_global_health |
Numeric (0-100). Patient's global assessment of health on a visual analog scale (0 = best/no activity, 100 = worst/highest activity). |
crp_units |
String. Units for the CRP input. Options: "mg/L" (default) or "mg/dL". |
Value
A list containing:
DAS28_CRP_Score |
The calculated disease activity score. |
Disease_Activity |
Classification (Remission < 2.6, Low 2.6-3.2, Moderate 3.2-5.1, High > 5.1). |
References
Prevoo ML, van 't Hof MA, Kuper HH, et al. Modified disease activity scores that include twenty-eight-joint counts. Development and validation in a prospective longitudinal study of patients with rheumatoid arthritis. Arthritis Rheum. 1995;38(1):44-48. Wells G, Becker JC, Teng J, et al. Validation of the 28-joint Disease Activity Score (DAS28) and European League Against Rheumatism response criteria based on C-reactive protein against disease progression in patients with rheumatoid arthritis, and comparison with the DAS28 based on erythrocyte sedimentation rate. Ann Rheum Dis. 2009;68(6):954-960.
Examples
# Example 1: High Disease Activity
# 10 tender, 8 swollen, CRP 25 mg/L, Global Health 60
das28_crp_rheumatoid_arthritis(10, 8, 25, 60)
# Example 2: Remission
# 0 tender, 0 swollen, CRP 1.0 mg/L, Global Health 10
das28_crp_rheumatoid_arthritis(0, 0, 1.0, 10)
Disease Activity Score-28 for Rheumatoid Arthritis (DAS28-ESR)
Description
Calculates the DAS28-ESR score, a standardized index of disease activity in Rheumatoid Arthritis. The score is calculated using the tender joint count (28 joints), swollen joint count (28 joints), Erythrocyte Sedimentation Rate (ESR), and the patient's global assessment of health. It stratifies patients into Remission, Low, Moderate, or High disease activity.
Usage
das28_esr_rheumatoid_arthritis(tender_joint_count, swollen_joint_count,
esr_mm_hr, patient_global_health)
Arguments
tender_joint_count |
Numeric (0-28). Number of tender joints identified during examination. |
swollen_joint_count |
Numeric (0-28). Number of swollen joints identified during examination. |
esr_mm_hr |
Numeric. Erythrocyte Sedimentation Rate in mm/hr. |
patient_global_health |
Numeric (0-100). Patient's global assessment of health on a visual analog scale (0 = best/no activity, 100 = worst/highest activity). |
Value
A list containing:
DAS28_ESR_Score |
The calculated disease activity score. |
Disease_Activity |
Classification (Remission < 2.6, Low 2.6-3.2, Moderate 3.2-5.1, High > 5.1). |
References
Prevoo ML, van 't Hof MA, Kuper HH, et al. Modified disease activity scores that include twenty-eight-joint counts. Development and validation in a prospective longitudinal study of patients with rheumatoid arthritis. Arthritis Rheum. 1995;38(1):44-48.
Examples
# Example 1: High Disease Activity
# 12 tender, 10 swollen, ESR 60, Global Health 70
das28_esr_rheumatoid_arthritis(12, 10, 60, 70)
# Example 2: Remission
# 0 tender, 0 swollen, ESR 10, Global Health 10
das28_esr_rheumatoid_arthritis(0, 0, 10, 10)
DASH Prediction Score for Recurrent VTE
Description
Calculates the DASH score to predict the risk of recurrent venous thromboembolism (VTE) in patients who have completed at least 3 months of anticoagulation for a first unprovoked VTE. The score helps determine whether indefinite anticoagulation is warranted.
Usage
dash_vte_recurrence_score(d_dimer_abnormal, age, sex, hormone_use_at_onset = 0)
Arguments
d_dimer_abnormal |
Numeric (0 or 1). Was the D-dimer level abnormal when measured roughly 1 month after stopping anticoagulation? (1 = Yes, +2 points). |
age |
Numeric. Patient age in years. (<= 50 years adds +1 point). |
sex |
String. Patient sex ("Male" or "Female"). (Male adds +1 point). |
hormone_use_at_onset |
Numeric (0 or 1). For females: Was the initial VTE associated with hormone use (e.g., OCPs, HRT)? (1 = Yes, -2 points). Defaults to 0. |
Value
A list containing:
DASH_Score |
The calculated score (Range -2 to 4). |
Risk_Category |
"Low Risk" (Score <= 1) or "High Risk" (Score >= 2). |
Annual_Recurrence_Risk |
Estimated annual risk of VTE recurrence. |
References
Tosetto A, Iorio A, Marcucci M, et al. Predicting disease recurrence in patients with previous unprovoked venous thromboembolism: a proposed prediction score (DASH). J Thromb Haemost. 2012;10(6):1019-1025. doi:10.1111/j.1538-7836.2012.04735.x
Examples
# Example 1: High Risk
# Male (+1), Age 45 (+1), Normal D-Dimer (0)
# Score = 2
dash_vte_recurrence_score(0, 45, "male")
# Example 2: Low Risk
# Female (0), Age 30 (+1), Hormone Use (-2), Normal D-Dimer (0)
# Score = -1
dash_vte_recurrence_score(0, 30, "female", 1)
Drug Abuse Screening Test (DAST-10)
Description
Calculates the DAST-10 score, a brief 10-item screening tool used to identify drug use problems in the past 12 months. It is designed for use in clinical and non-clinical settings.
Usage
dast_10_screening(used_drugs_non_medical, abuse_multiple_drugs,
able_to_stop_when_wanted, blackouts_flashbacks, feel_guilty,
spouse_parents_complain, neglected_family, illegal_activities,
withdrawal_symptoms, medical_problems)
Arguments
used_drugs_non_medical |
Numeric (0 or 1). Have you used drugs other than those required for medical reasons? (1 = Yes). |
abuse_multiple_drugs |
Numeric (0 or 1). Do you abuse more than one drug at a time? (1 = Yes). |
able_to_stop_when_wanted |
Numeric (0 or 1). Are you always able to stop using drugs when you want to? (1 = Yes, 0 = No). **Note: "No" scores 1 point.** |
blackouts_flashbacks |
Numeric (0 or 1). Have you had "blackouts" or "flashbacks" as a result of drug use? (1 = Yes). |
feel_guilty |
Numeric (0 or 1). Do you ever feel bad or guilty about your drug use? (1 = Yes). |
spouse_parents_complain |
Numeric (0 or 1). Does your spouse (or parents) ever complain about your involvement with drugs? (1 = Yes). |
neglected_family |
Numeric (0 or 1). Have you neglected your family because of your use of drugs? (1 = Yes). |
illegal_activities |
Numeric (0 or 1). Have you engaged in illegal activities in order to obtain drugs? (1 = Yes). |
withdrawal_symptoms |
Numeric (0 or 1). Have you ever experienced withdrawal symptoms (felt sick) when you stopped taking drugs? (1 = Yes). |
medical_problems |
Numeric (0 or 1). Have you had medical problems as a result of your drug use (e.g., memory loss, hepatitis, convulsions, bleeding)? (1 = Yes). |
Value
A list containing:
DAST_10_Score |
The calculated total score (Range 0-10). |
Severity_Level |
Interpretation (No problems, Low, Moderate, Substantial, Severe). |
Suggested_Action |
Clinical recommendation based on the severity level. |
References
Skinner HA. The drug abuse screening test. Addict Behav. 1982;7(4):363-371. doi:10.1016/0306-4603(82)90005-3
Examples
# Example 1: Substantial Problem
# Used drugs, Multiple drugs, Can't stop (0), Guilt, Complaints, Withdrawal
# Score = 1+1+1+0+1+1+0+0+1+0 = 6
dast_10_screening(1, 1, 0, 0, 1, 1, 0, 0, 1, 0)
# Example 2: Low Level
# Used drugs only
# Score = 1
dast_10_screening(1, 0, 1, 0, 0, 0, 0, 0, 0, 0)
DECAF Score for Acute Exacerbation of COPD
Description
Calculates the DECAF score to predict in-hospital mortality in patients hospitalized with an acute exacerbation of COPD. The score is based on Dyspnea (eMRCD), Eosinopenia, Consolidation, Acidemia, and Atrial Fibrillation.
Usage
decaf_score_copd(emrcd_5a_5b, eosinophils, consolidation, ph_value,
atrial_fibrillation)
Arguments
emrcd_5a_5b |
Numeric (0 or 1). Extended MRC Dyspnea Score 5a (too breathless to leave house) or 5b (breathless dressing/undressing). (1 = Yes, +1 point). |
eosinophils |
Numeric. Eosinophil count in x10^9/L. (< 0.05 adds +1 point). |
consolidation |
Numeric (0 or 1). Consolidation present on Chest X-ray. (1 = Yes, +1 point). |
ph_value |
Numeric. Arterial or Venous pH. (< 7.30 adds +1 point). |
atrial_fibrillation |
Numeric (0 or 1). Atrial Fibrillation present on admission ECG or history. (1 = Yes, +1 point). |
Value
A list containing:
DECAF_Score |
The calculated score (Range 0-5). |
Risk_Group |
Classification (Low 0-1, Intermediate 2, High 3-5). |
In_Hospital_Mortality |
Estimated in-hospital mortality rate. |
References
Steer J, Gibson J, Bourke SC. The DECAF Score: predicting hospital mortality in exacerbations of chronic obstructive pulmonary disease. Thorax. 2012;67(11):970-976. doi:10.1136/thoraxjnl-2012-202103
Examples
# Example 1: High Risk
# eMRCD 5b (1), Eos 0.02 (1), Consolidation (1), pH 7.35 (0), AFib (0)
# Score = 3
decaf_score_copd(1, 0.02, 1, 7.35, 0)
# Example 2: Low Risk
# eMRCD 4 (0), Eos 0.2 (0), No consolidation (0), pH 7.4 (0), No AFib (0)
# Score = 0
decaf_score_copd(0, 0.2, 0, 7.4, 0)
Dutch-English LEMS Tumor Association Prediction (DELTA-P) Score
Description
Calculates the DELTA-P score to predict the likelihood of Small Cell Lung Cancer (SCLC) in patients with Lambert-Eaton Myasthenic Syndrome (LEMS). The score assigns 1 point for each of six risk factors present at diagnosis: Bulbar weakness, Erectile dysfunction (in males), Weight loss >= 5%, Tobacco use at onset, Age at onset >= 50 years, and Karnofsky Performance Status < 70.
Usage
delta_p_lems_score(bulbar_weakness, erectile_dysfunction_male,
weight_loss_ge_5pct, tobacco_at_onset, age_onset_ge_50,
kps_lt_70)
Arguments
bulbar_weakness |
Numeric (0 or 1). Presence of dysarthria, dysphagia, chewing weakness, or neck weakness. (1 = Yes). |
erectile_dysfunction_male |
Numeric (0 or 1). Presence of erectile dysfunction in a male patient. (1 = Yes, 0 = No/Female). |
weight_loss_ge_5pct |
Numeric (0 or 1). Weight loss of 5% or more. (1 = Yes). |
tobacco_at_onset |
Numeric (0 or 1). Smoking at the time of LEMS onset. (1 = Yes). |
age_onset_ge_50 |
Numeric (0 or 1). Age at onset of symptoms >= 50 years. (1 = Yes). |
kps_lt_70 |
Numeric (0 or 1). Karnofsky Performance Status < 70 (0-60). (1 = Yes). |
Value
A list containing:
DELTA_P_Score |
The calculated score (Range 0-6). |
SCLC_Probability |
Estimated percentage probability of having SCLC. |
References
Titulaer MJ, Maddison P, Sont JK, et al. Clinical Dutch-English Lambert-Eaton myasthenic syndrome (LEMS) tumor association prediction score accurately predicts small-cell lung cancer in the LEMS. J Clin Oncol. 2011;29(7):902-908. doi:10.1200/JCO.2010.32.0440
Examples
# Example 1: Low Risk
# Young female, non-smoker, no weight loss
# Score = 0
delta_p_lems_score(0, 0, 0, 0, 0, 0)
# Example 2: High Risk
# 60yo Male, Smoker, Erectile Dysfunction, Wt Loss
# Score = 1 (Age) + 1 (Sex/ED) + 1 (Wt) + 1 (Smoke) = 4
delta_p_lems_score(0, 1, 1, 1, 1, 0)
Denver HIV Risk Score
Description
Calculates the Denver HIV Risk Score to categorize patients into risk groups for HIV infection. This tool helps target HIV screening resources by identifying individuals with a higher pre-test probability of infection. The scoring algorithm differs for men and women.
Usage
denver_hiv_risk_score(age, sex, msm, injection_drug_use,
vaginal_anal_sex_no_condom, std_history)
Arguments
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). |
msm |
Numeric (0 or 1). For males: Sex with men? (1 = Yes). |
injection_drug_use |
Numeric (0 or 1). Injection drug use? (1 = Yes). |
vaginal_anal_sex_no_condom |
Numeric (0 or 1). Vaginal or anal sex without a condom? (1 = Yes). |
std_history |
Numeric (0 or 1). For females: History of sexually transmitted disease? (1 = Yes). |
Value
A list containing:
Denver_Score |
The calculated risk score (Range 0-~80 depending on combinations). |
Risk_Category |
Classification (Low <20, Moderate 20-29, High 30-39, Very High 40-49, Extremely High >=50). |
Estimated_Prevalence |
Estimated prevalence of undiagnosed HIV in this risk group. |
References
Haukoos JS, Hopkins E, Bender B, et al. Comparison of enhanced targeted rapid HIV screening using the Denver HIV Risk Score to nontargeted rapid HIV screening in the emergency department. Ann Emerg Med. 2013;61(3):353-361. doi:10.1016/j.annemergmed.2012.11.002
Examples
# Example 1: High Risk Male
# 35yo (+14), MSM (+18), Unprotected Sex (+12)
# Score = 44 (Very High Risk)
denver_hiv_risk_score(35, "male", 1, 0, 1, 0)
# Example 2: Moderate Risk Female
# 25yo (+3), IVDU (+21)
# Score = 24 (Moderate Risk)
denver_hiv_risk_score(25, "female", 0, 1, 0, 0)
DHAKA Score for Dehydration in Children
Description
Calculates the Dehydration: Assessing Kids Accurately (DHAKA) score. This tool assesses the severity of dehydration in children (aged 1 month to 5 years) with acute diarrhea. It is validated for use in low-resource settings to guide rehydration therapy (ORS vs IV).
Usage
dhaka_dehydration_score(general_appearance, sunken_eyes, dry_mucous_membranes,
tears_absent, skin_turgor, deep_breathing)
Arguments
general_appearance |
Numeric (0-2). 0: Alert/Normal. 1: Restless/Irritable. 2: Lethargic/Unconscious. |
sunken_eyes |
Numeric (0 or 1). Are the eyes sunken? (1 = Yes). |
dry_mucous_membranes |
Numeric (0 or 1). Are the mucous membranes (mouth/tongue) dry? (1 = Yes). |
tears_absent |
Numeric (0 or 1). Are tears absent when crying? (1 = Yes). |
skin_turgor |
Numeric (0-2). Skin pinch test (abdominal). 0: Immediate return (Normal). 1: Slow return (1-2 seconds). 2: Very slow return (> 2 seconds). |
deep_breathing |
Numeric (0 or 1). Presence of deep, acidotic breathing? (1 = Yes). |
Value
A list containing:
DHAKA_Score |
The calculated score (Range 0-8). |
Dehydration_Status |
Classification (No Dehydration, Some Dehydration, Severe Dehydration). |
Management_Plan |
Recommended rehydration strategy (ORS or IV). |
References
Levine AC, Glavis-Bloom J, Modi P, et al. Derivation and internal validation of the DHAKA score for dehydration assessment in children with acute diarrhea in low-resource settings. Glob Health Sci Pract. 2013;1(1):97-108. doi:10.9745/GHSP-D-12-00012 Levine AC, Munyaneza RM, Glavis-Bloom J, et al. Prediction of severe dehydration in children with diarrhea/vomiting using the DHAKA score. Pediatrics. 2016.
Examples
# Example 1: Severe Dehydration
# Lethargic (2), Sunken Eyes (1), Dry Mouth (1), No Tears (1),
#Very Slow Turgor (2), Deep Breathing (1)
# Score = 8
dhaka_dehydration_score(2, 1, 1, 1, 2, 1)
# Example 2: Some Dehydration
# Restless (1), Sunken Eyes (1), Normal Turgor (0), Tears Present (0)
# Score = 2
dhaka_dehydration_score(1, 1, 0, 0, 0, 0)
Diabetes Distress Scale (DDS-17)
Description
Calculates the total mean score and four subscale scores for the Diabetes Distress Scale (DDS-17). This 17-item instrument assesses the emotional burden and distress associated with diabetes management. Scores are categorized as little/no distress (<2.0), moderate distress (2.0-2.9), or high distress (>=3.0).
Usage
diabetes_distress_scale(q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12,
q13, q14, q15, q16, q17)
Arguments
q1 |
Numeric (1-6). Feeling that diabetes is taking up too much of my mental and physical energy every day. |
q2 |
Numeric (1-6). Feeling that my doctor doesn't know enough about diabetes and diabetes care. |
q3 |
Numeric (1-6). Feeling angry, scared, and/or depressed when I think about living with diabetes. |
q4 |
Numeric (1-6). Feeling that my doctor doesn't give me clear enough directions on how to manage my diabetes. |
q5 |
Numeric (1-6). Feeling that I am not testing my blood sugars frequently enough. |
q6 |
Numeric (1-6). Feeling that I am often failing with my diabetes routine. |
q7 |
Numeric (1-6). Friends or family are not supportive enough of self-care efforts (e.g. planning activities that conflict with my schedule, encouraging me to eat the "wrong" foods). |
q8 |
Numeric (1-6). Feeling that diabetes controls my life. |
q9 |
Numeric (1-6). Feeling that my doctor doesn't take my concerns seriously enough. |
q10 |
Numeric (1-6). Not feeling confident in my day-to-day ability to manage diabetes. |
q11 |
Numeric (1-6). Feeling that I will end up with serious long-term complications, no matter what I do. |
q12 |
Numeric (1-6). Feeling that I am not sticking closely enough to a good meal plan. |
q13 |
Numeric (1-6). Friends or family don't appreciate how difficult living with diabetes can be. |
q14 |
Numeric (1-6). Feeling overwhelmed by the demands of living with diabetes. |
q15 |
Numeric (1-6). Feeling that I don't have a doctor who I can see regularly enough about my diabetes. |
q16 |
Numeric (1-6). Not feeling motivated to keep up my diabetes self management. |
q17 |
Numeric (1-6). Friends or family act like "diabetes police" (e.g. asking "did you eat that?" or "did you take your medicine?"). |
Details
Scoring Key: 1: Not a problem 2: A slight problem 3: A moderate problem 4: Somewhat serious problem 5: A serious problem 6: A very serious problem
Subscales: - Emotional Burden: Q1, Q3, Q8, Q11, Q14 - Physician-related Distress: Q2, Q4, Q9, Q15 - Regimen-related Distress: Q5, Q6, Q10, Q12, Q16 - Interpersonal Distress: Q7, Q13, Q17
Value
A list containing:
Total_Mean_Score |
The average of all 17 items. |
Total_Interpretation |
Clinical interpretation of the total score. |
Subscales |
A list containing the mean scores and interpretations for each of the four domains. |
References
Polonsky WH, Fisher L, Earles J, et al. Assessing psychosocial distress in diabetes: development of the diabetes distress scale. Diabetes Care. 2005;28(3):626-631. doi:10.2337/diacare.28.3.626
Examples
# Example 1: Moderate Distress
# All items scored 3 (Moderate problem)
# Result: Mean 3.0 (High Distress)
diabetes_distress_scale(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3)
# Example 2: Mixed Profile
# Emotional items 5 (High), others 1 (Low)
diabetes_distress_scale(5, 1, 5, 1, 1, 1, 1, 5, 1, 1, 5, 1, 1, 5, 1, 1, 1)
DigiFab Dosing for Digoxin Poisoning
Description
Calculates the recommended number of DigiFab (Digoxin Immune Fab) vials for the treatment of digoxin toxicity. The calculator prioritizes dosing based on serum digoxin concentration, followed by the amount ingested (for acute cases), and finally defaults to empiric dosing guidelines if neither is known.
Usage
digifab_dosing(poisoning_type, weight_kg, digoxin_level_ng_ml = NULL,
amount_ingested_mg = NULL)
Arguments
poisoning_type |
String. "acute" or "chronic". |
weight_kg |
Numeric. Patient weight in kilograms. |
digoxin_level_ng_ml |
Numeric (Optional). Serum digoxin concentration in ng/mL. This is the preferred method for calculation. |
amount_ingested_mg |
Numeric (Optional). Estimated amount of digoxin ingested in milligrams. Used for acute cases if serum level is unknown. |
Value
A list containing:
Recommended_Vials |
The calculated number of vials (rounded up to the nearest whole number). |
Total_Dose_mg |
The total dose in milligrams (40 mg per vial). |
Calculation_Method |
The method used to determine the dose (Serum Level, Amount Ingested, or Empiric). |
References
DigiFab [package insert]. King of Prussia, PA: BTG International Inc; 2017. Antman EM, Wenger TL, Butler VP Jr, Haber E, Smith TW. Treatment of 150 cases of life-threatening digitalis intoxication with digoxin-specific Fab antibody fragments. Final report of a multicenter study. Circulation. 1990;81(6):1744-1752.
Examples
# Example 1: Known Serum Level
# Chronic toxicity, 70kg, Level 4.0 ng/mL
# Dose = (4 * 70) / 100 = 2.8 -> 3 vials
digifab_dosing("chronic", 70, digoxin_level_ng_ml = 4.0)
# Example 2: Acute Ingestion (Unknown Level)
# Acute, 60kg, Ingested 10 mg
# Dose = 10 * 1.6 = 16 vials
digifab_dosing("acute", 60, amount_ingested_mg = 10)
# Example 3: Empiric Acute
# Acute, 80kg, Unknown details
# Dose = 10 vials (Empiric)
digifab_dosing("acute", 80)
Dynamic International Prognostic Scoring System (DIPSS) for Myelofibrosis
Description
Calculates the DIPSS score to estimate overall survival in patients with primary myelofibrosis. This dynamic scoring system can be used at any point during the disease course, unlike the IPSS which is valid only at diagnosis. The score is based on age, white blood cell count, hemoglobin, peripheral blood blasts, and constitutional symptoms.
Usage
dipss_myelofibrosis(age, hemoglobin_g_dl, wbc_count_10_9_l,
circulating_blasts_percent, constitutional_symptoms)
Arguments
age |
Numeric. Patient age in years. (> 65 years adds +1 point). |
hemoglobin_g_dl |
Numeric. Hemoglobin level in g/dL. (< 10 g/dL adds +2 points). |
wbc_count_10_9_l |
Numeric. White Blood Cell count in 10^9/L. (> 25 x 10^9/L adds +1 point). |
circulating_blasts_percent |
Numeric. Percentage of circulating blasts in peripheral blood. (>= 1% adds +1 point). |
constitutional_symptoms |
Numeric (0 or 1). Presence of constitutional symptoms (weight loss >10% in 6 months, unexplained fever, or excessive sweating). (1 = Yes, +1 point). |
Value
A list containing:
DIPSS_Score |
The calculated total score (Range 0-6). |
Risk_Category |
Risk classification (Low, Int-1, Int-2, High). |
Median_Overall_Survival |
Estimated median survival time. |
References
Passamonti F, Cervantes F, Vannucchi AM, et al. A dynamic prognostic model to predict survival in primary myelofibrosis: a study by the IWG-MRT (International Working Group for Myelofibrosis Research and Treatment). Blood. 2010;115(9):1703-1708. doi:10.1182/blood-2009-09-245837
Examples
# Example 1: High Risk
# Age 70 (+1), Hb 9 (+2), WBC 30 (+1), Blasts 2% (+1), Symptoms Yes (+1)
# Score = 6
dipss_myelofibrosis(70, 9.0, 30, 2, 1)
# Example 2: Intermediate-1
# Age 50 (0), Hb 11 (0), WBC 10 (0), Blasts 0 (0), Symptoms Yes (+1)
# Score = 1
dipss_myelofibrosis(50, 11.0, 10, 0, 1)
DIRE Score for Opioid Treatment
Description
Calculates the DIRE Score (Diagnosis, Intractability, Risk, Efficacy) to predict the efficacy and compliance of long-term opioid analgesic treatment for non-cancer pain. The score evaluates 7 factors, each rated on a scale of 1 to 3.
Usage
dire_opioid_score(diagnosis, intractability, risk_psychological, risk_chemical,
risk_reliability, risk_social, efficacy)
Arguments
diagnosis |
Numeric (1-3). 1: Benign condition with minimal objective findings. 2: Slowly progressive condition with moderate objective findings. 3: Advanced condition with clear objective findings. |
intractability |
Numeric (1-3). 1: Few therapies tried, patient passive. 2: Most therapies tried, limited response. 3: Fully engaged, multiple therapies failed. |
risk_psychological |
Numeric (1-3). 1: Severe personality disorder or mental illness. 2: Moderate or treated mental illness. 3: Good psychological stability. |
risk_chemical |
Numeric (1-3). 1: Active or recent addiction. 2: History of addiction in remission. 3: No history of chemical dependency. |
risk_reliability |
Numeric (1-3). 1: History of medication misuse, missed appointments. 2: Occasional difficulties with compliance. 3: Highly reliable, compliant with care. |
risk_social |
Numeric (1-3). 1: Chaotic life, poor support. 2: Moderate support. 3: Supportive family/friends, stable life. |
efficacy |
Numeric (1-3). 1: Poor function or minimal pain relief with opioids. 2: Moderate benefit. 3: Good improvement in function and pain. |
Value
A list containing:
DIRE_Score |
The calculated total score (Range 7-21). |
Suitability |
Interpretation of the score (Suitable >= 14, Not Suitable <= 13). |
References
Belgrade MJ, Schamber CD, Lindgren BR. The DIRE score: predicting outcomes of opioid prescribing for chronic pain. J Pain. 2006;7(9):671-681. doi:10.1016/j.jpain.2006.03.001
Examples
# Example 1: Poor Candidate
# All items scored 1
dire_opioid_score(1, 1, 1, 1, 1, 1, 1)
# Example 2: Good Candidate
# All items scored 3
dire_opioid_score(3, 3, 3, 3, 3, 3, 3)
Disease Steps for Multiple Sclerosis
Description
Retrieves the clinical description for a given Disease Steps (DS) score. The Disease Steps scale is a simple, ordinal rating system (0-6) used to classify functional disability in Multiple Sclerosis patients, primarily based on ambulation and gait. It serves as a complementary tool to the more complex Expanded Disability Status Scale (EDSS).
Usage
disease_steps_ms(classification)
Arguments
classification |
Numeric (0-6). The patient's Disease Step score. 0: Normal. 1: Mild Disability (No visible gait abnormality). 2: Moderate Disability (Visible gait abnormality, walks 25ft <= 20s). 3: Early Cane (Intermittent support, walks 25ft <= 20s). 4: Late Cane (Dependent on unilateral support). 5: Bilateral Support (Dependent on bilateral support). 6: Confined to Wheelchair. |
Value
A list containing:
Disease_Step |
The input score. |
Clinical_Description |
The official definition of the functional status associated with the score. |
References
Hohol MJ, Orav EJ, Weiner HL. Disease steps in multiple sclerosis: a simple approach to evaluate disease progression. Neurology. 1995;45(2):251-255. doi:10.1212/wnl.45.2.251
Examples
# Example 1: Moderate Disability
# Patient has a visible limp but walks 25 feet quickly
disease_steps_ms(2)
# Example 2: Late Cane
# Patient requires a cane at all times to walk 25 feet
disease_steps_ms(4)
Diabetic Ketoacidosis Mortality Prediction Model (DKA-MPM) Score
Description
Calculates the DKA-MPM score to predict in-hospital mortality in patients with Diabetic Ketoacidosis (DKA). The score is based on clinical and laboratory variables assessed at presentation and during the first 24 hours of admission.
Usage
dka_mpm_score(severe_comorbidities, ph_lt_7, insulin_req_gt_50,
glucose_gt_300_12hr, depressed_mental_status, fever_24hr)
Arguments
severe_comorbidities |
Numeric (0 or 1). Presence of severe comorbidities (e.g., immunosuppression, cancer, renal failure). (1 = Yes, +6 points). |
ph_lt_7 |
Numeric (0 or 1). Arterial pH < 7.0 at presentation. (1 = Yes, +4 points). |
insulin_req_gt_50 |
Numeric (0 or 1). Requirement of > 50 units of regular insulin in the first 12 hours. (1 = Yes, +4 points). |
glucose_gt_300_12hr |
Numeric (0 or 1). Serum glucose > 300 mg/dL (16.7 mmol/L) after 12 hours of treatment. (1 = Yes, +4 points). |
depressed_mental_status |
Numeric (0 or 1). Depressed mental status (e.g., lethargy, stupor, coma) after 24 hours. (1 = Yes, +4 points). |
fever_24hr |
Numeric (0 or 1). Presence of fever (> 38 C) after 24 hours. (1 = Yes, +3 points). |
Value
A list containing:
DKA_MPM_Score |
The calculated risk score (Range 0-25). |
Risk_Group |
Risk classification (Low vs. High). |
Estimated_Mortality |
Estimated in-hospital mortality percentage. |
References
Efstathiou SP, Tsioulos DI, Tsiakou AG, et al. A mortality prediction model in diabetic ketoacidosis. Clin Endocrinol (Oxf). 2002;57(5):595-601. doi:10.1046/j.1365-2265.2002.01636.x
Examples
# Example 1: High Risk
# Severe comorbidities (+6), pH < 7 (+4), High Insulin req (+4), Mental status (+4)
# Score = 18 (Note: Cutoff is typically split around 14/19, this falls in between but close to high)
dka_mpm_score(1, 1, 1, 0, 1, 0)
# Example 2: Low Risk
# No risk factors present
# Score = 0
dka_mpm_score(0, 0, 0, 0, 0, 0)
Donor Lymphocyte Infusion (DLI) Volume Calculator
Description
Estimates the volume of whole blood to process via apheresis to collect the required number of CD3+ cells for Donor Lymphocyte Infusion (DLI). The calculation accounts for recipient weight, target dose per infusion, number of infusions, donor blood parameters, and machine collection efficiency.
Usage
dli_volume_calculator(recipient_weight_kg, target_cd3_dose_per_kg,
donor_wbc_count_cells_ul, donor_lymphocyte_percent,
donor_cd3_percent, collection_efficiency_percent,
num_infusions)
Arguments
recipient_weight_kg |
Numeric. Recipient's weight in kilograms. |
target_cd3_dose_per_kg |
Numeric. The target dose of CD3+ cells per kg (e.g., 1e7). |
donor_wbc_count_cells_ul |
Numeric. Donor's White Blood Cell count in cells/uL (e.g., 6000). |
donor_lymphocyte_percent |
Numeric. Percentage of lymphocytes in the donor's WBC differential (0-100). |
donor_cd3_percent |
Numeric. Percentage of CD3+ cells within the lymphocyte population (0-100). |
collection_efficiency_percent |
Numeric. The efficiency of the apheresis machine in collecting lymphocytes (typically 40-60%). |
num_infusions |
Numeric. The total number of DLI doses planned for the recipient. |
Value
A list containing:
Volume_to_Process_L |
The estimated volume of donor blood to process in Liters. |
Total_CD3_Cells_Required |
The total absolute count of CD3+ cells needed. |
Donor_CD3_Concentration_cells_mL |
The calculated concentration of CD3+ cells in the donor's blood. |
References
Guidelines on the Use of Therapeutic Apheresis in Clinical Practice. J Clin Apher. 2019.
Examples
# Example 1: Standard Collection
# 70kg Recipient, Target 1x10^7 cells/kg, 1 Dose
# Donor: WBC 6000/uL, Lymphs 30%, CD3 70%, Efficiency 50%
dli_volume_calculator(70, 1e7, 6000, 30, 70, 50, 1)
# Example 2: Multiple Doses
# Same patient, but 3 doses planned
dli_volume_calculator(70, 1e7, 6000, 30, 70, 50, 3)
DOAC Score for Bleeding Risk
Description
Calculates the DOAC Score to estimate the risk of major bleeding in patients with atrial fibrillation taking Direct Oral Anticoagulants (DOACs). This score was derived specifically for DOAC users, distinguishing it from HAS-BLED which was derived for Warfarin.
Usage
doac_bleeding_risk(age, criteria_count_gt_1, creatinine_clearance_ml_min,
prior_bleeding, hypertension, nsaids_antiplatelets,
cirrhosis_history, history_stroke, prior_major_bleeding,
extreme_body_weight)
Arguments
age |
Numeric. Patient age in years. (65-74: +1 pt; >=75: +2 pts). |
criteria_count_gt_1 |
Numeric (0 or 1). Does the patient meet criteria for having >1 comorbid condition (e.g., diabetes, stroke, etc.)? (1 = Yes, +2 pts). (Note: This input simplifies a complex comorbidity count often used in the original derivation). |
creatinine_clearance_ml_min |
Numeric. Creatinine Clearance (CrCl). (< 60 mL/min adds +1 pt). |
prior_bleeding |
Numeric (0 or 1). History of any prior bleeding event (minor or major). (1 = Yes, +2 pts). |
hypertension |
Numeric (0 or 1). History of Hypertension. (1 = Yes, +1 pt). |
nsaids_antiplatelets |
Numeric (0 or 1). Concomitant use of NSAIDs or Antiplatelets. (1 = Yes, +1 pt). |
cirrhosis_history |
Numeric (0 or 1). History of Liver Cirrhosis. (1 = Yes, +1 pt). |
history_stroke |
Numeric (0 or 1). History of Stroke/TIA. (1 = Yes, +1 pt). |
prior_major_bleeding |
Numeric (0 or 1). History of Major Bleeding specifically. (1 = Yes, +1 pt). |
extreme_body_weight |
Numeric (0 or 1). Extreme body weight (<50kg or >100kg). (1 = Yes, +1 pt). |
Value
A list containing:
DOAC_Score |
The calculated risk score. |
Risk_Category |
Classification (Low <=3, Moderate 4-7, High >=8). |
References
Kozieł-Siołkowska M, et al. A Novel Bleeding Risk Score for Patients with Atrial Fibrillation on Direct Oral Anticoagulants (The DOAC Score). Cardiology. 2018.
Examples
# Example 1: Moderate Risk
# Age 70 (+1), CrCl 50 (+1), HTN (+1), NSAIDs (+1)
# Score = 4
doac_bleeding_risk(70, 0, 50, 0, 1, 1, 0, 0, 0, 0)
# Example 2: High Risk
# Age 80 (+2), Prior Bleed (+2), Major Bleed (+1), Stroke (+1), Wt<50 (+1), CrCl 40 (+1)
# Score = 8
doac_bleeding_risk(80, 0, 40, 1, 0, 0, 0, 1, 1, 1)
DRAGON Score for Post-tPA Stroke Outcome
Description
Calculates the DRAGON score to predict the 3-month functional outcome (modified Rankin Scale) in acute ischemic stroke patients treated with intravenous tissue plasminogen activator (tPA). The score ranges from 0 to 10, with higher scores indicating a worse prognosis.
Usage
dragon_score_stroke(hyperdense_cerebral_artery, early_infarct_signs,
mrs_prestroke_gt_1, age, glucose, onset_to_treatment_gt_90,
baseline_nihss, glucose_units = "mg/dL")
Arguments
hyperdense_cerebral_artery |
Numeric (0 or 1). Presence of hyperdense cerebral artery sign on admission CT. |
early_infarct_signs |
Numeric (0 or 1). Presence of early infarct signs on admission CT. |
mrs_prestroke_gt_1 |
Numeric (0 or 1). Pre-stroke modified Rankin Scale score > 1. (1 = Yes). |
age |
Numeric. Patient age in years. <65: 0 pts. 65-79: 1 pt. >=80: 2 pts. |
glucose |
Numeric. Baseline blood glucose level. (> 144 mg/dL or > 8 mmol/L adds 1 point). |
onset_to_treatment_gt_90 |
Numeric (0 or 1). Onset to treatment time > 90 minutes. (1 = Yes). |
baseline_nihss |
Numeric. Baseline NIH Stroke Scale score. 0-4: 0 pts. 5-9: 1 pt. 10-15: 2 pts. >15: 3 pts. |
glucose_units |
String. Units for glucose input. Options: "mg/dL" (default) or "mmol/L". |
Details
CT Findings Scoring: - Neither hyperdense artery nor early infarct signs: 0 points. - Either one present: 1 point. - Both present: 2 points.
Value
A list containing:
DRAGON_Score |
The calculated total score (Range 0-10). |
Risk_Category |
Prognostic grouping (Good, Intermediate, Poor). |
Outcome_Probability_3_Months |
Estimated likelihood of good/poor outcome based on validation studies. |
References
Strbian D, Meretoja A, Ahlhelm FJ, et al. Predicting outcome of IV thrombolysis-treated ischemic stroke patients: the DRAGON score. Neurology. 2012;78(6):427-432. doi:10.1212/WNL.0b013e318245d2a9
Examples
# Example 1: Poor Prognosis
# Both CT signs (2), mRS>1 (1), Age 85 (2), Gluc 150 (1), Time >90 (1), NIHSS 20 (3)
# Score = 10
dragon_score_stroke(1, 1, 1, 85, 150, 1, 20)
# Example 2: Good Prognosis
# No CT signs, mRS 0, Age 60, Gluc 100, Time <90, NIHSS 4
# Score = 0
dragon_score_stroke(0, 0, 0, 60, 100, 0, 4)
Drug Resistance in Pneumonia (DRIP) Score
Description
Calculates the DRIP Score to predict the risk of drug-resistant pathogens in patients with community-acquired pneumonia (CAP). This tool helps guide empiric antibiotic selection, potentially reducing the unnecessary use of broad-spectrum agents (like vancomycin or piperacillin-tazobactam) in low-risk patients.
Usage
drip_pneumonia_score(antibiotic_use_60d, long_term_care, tube_feeding,
prior_drug_resistant_organism_1yr, hospitalization_60d,
chronic_pulmonary_disease, poor_functional_status,
acid_suppression_14d, wound_care, mrsa_colonization_1yr)
Arguments
antibiotic_use_60d |
Numeric (0 or 1). Antibiotic use within the past 60 days. (1 = Yes, +2 points). |
long_term_care |
Numeric (0 or 1). Resident of a long-term care facility (nursing home, skilled nursing, rehab; excludes assisted living/group homes). (1 = Yes, +2 points). |
tube_feeding |
Numeric (0 or 1). Presence of tube feeding (NG, NJ, or PEG). (1 = Yes, +2 points). |
prior_drug_resistant_organism_1yr |
Numeric (0 or 1). Prior culture-proven drug-resistant pneumonia within the past year. (1 = Yes, +2 points). |
hospitalization_60d |
Numeric (0 or 1). Hospitalization within the past 60 days. (1 = Yes, +1 point). |
chronic_pulmonary_disease |
Numeric (0 or 1). History of chronic pulmonary disease (COPD, Asthma, ILD, etc.). (1 = Yes, +1 point). |
poor_functional_status |
Numeric (0 or 1). Poor functional status (Karnofsky < 70 or non-ambulatory). (1 = Yes, +1 point). |
acid_suppression_14d |
Numeric (0 or 1). Use of gastric acid suppression (PPI or H2 blocker) within the past 14 days. (1 = Yes, +1 point). |
wound_care |
Numeric (0 or 1). Active wound care at the time of admission. (1 = Yes, +1 point). |
mrsa_colonization_1yr |
Numeric (0 or 1). Documented MRSA colonization within the past year. (1 = Yes, +1 point). |
Value
A list containing:
DRIP_Score |
The calculated total score (Range 0-14). |
Risk_Level |
"Low Risk" (<4) or "High Risk" (>=4). |
Recommendation |
Antibiotic stewardship guidance. |
References
Webb BJ, Dascomb K, Stenehjem E, et al. Derivation and Multicenter Validation of the Drug Resistance in Pneumonia Clinical Prediction Score. Antimicrob Agents Chemother. 2016;60(5):2652-2663. doi:10.1128/AAC.03071-15
Examples
# Example 1: High Risk
# Recent Abx (+2), LTC (+2), Chronic lung disease (+1)
# Score = 5
drip_pneumonia_score(1, 1, 0, 0, 0, 1, 0, 0, 0, 0)
# Example 2: Low Risk
# Hospitalization (+1), PPI use (+1)
# Score = 2
drip_pneumonia_score(0, 0, 0, 0, 1, 0, 0, 1, 0, 0)
DSM-5 Diagnostic Criteria for Binge Eating Disorder (BED)
Description
Evaluates the diagnostic criteria for Binge Eating Disorder according to the DSM-5. It checks for recurrent episodes, associated symptoms, distress, frequency/duration, and the absence of compensatory behaviors (ruling out Bulimia Nervosa). It also specifies severity based on the frequency of episodes per week.
Usage
dsm5_binge_eating_disorder(recurrent_episodes, symptom_count, marked_distress,
time_criteria_met, no_compensatory_behavior,
frequency_per_week)
Arguments
recurrent_episodes |
Numeric (0 or 1). Criterion A: Recurrent episodes of binge eating characterized by eating a large amount in a discrete period and a lack of control. (1 = Yes). |
symptom_count |
Numeric (0-5). Criterion B: Number of associated symptoms present (Eating rapidly, Eating until uncomfortably full, Eating large amounts when not hungry, Eating alone due to embarrassment, Feeling disgusted/guilty). Diagnosis requires >= 3. |
marked_distress |
Numeric (0 or 1). Criterion C: Marked distress regarding binge eating is present. (1 = Yes). |
time_criteria_met |
Numeric (0 or 1). Criterion D: The binge eating occurs, on average, at least once a week for 3 months. (1 = Yes). |
no_compensatory_behavior |
Numeric (0 or 1). Criterion E: The binge eating is NOT associated with recurrent use of inappropriate compensatory behavior (e.g., purging) and does not occur exclusively during the course of bulimia nervosa or anorexia nervosa. (1 = Yes, criteria met). |
frequency_per_week |
Numeric. The number of binge eating episodes per week (used for severity specification). |
Value
A list containing:
Diagnosis |
"Criteria Met" or "Criteria Not Met". |
Severity_Specification |
Classification based on frequency (Mild, Moderate, Severe, Extreme). |
Missing_Criteria |
List of specific criteria that were not satisfied. |
References
American Psychiatric Association. Diagnostic and Statistical Manual of Mental Disorders. 5th ed. Arlington, VA: American Psychiatric Association; 2013.
Examples
# Example 1: Moderate BED
# Recurrent(1), 4 symptoms(4), Distress(1), Time Met(1), No Purging(1), 5x/week
dsm5_binge_eating_disorder(1, 4, 1, 1, 1, 5)
# Example 2: Criteria Not Met (Symptom Count)
# Recurrent(1), only 1 symptom(1), Distress(1), Time Met(1), No Purging(1), 2x/week
dsm5_binge_eating_disorder(1, 1, 1, 1, 1, 2)
DSM-5 Criteria for Bipolar Disorder
Description
Evaluates patient symptoms against the DSM-5 criteria for Bipolar I and Bipolar II Disorders. The function determines if a distinct period of abnormal mood qualifies as a Manic or Hypomanic episode based on symptom count, duration, and severity, and then applies diagnostic hierarchy (e.g., presence of Mania implies Bipolar I; Hypomania + Major Depression implies Bipolar II).
Usage
dsm5_bipolar_criteria(symptom_count, irritable_mood_only, duration_days,
hospitalized, psychotic_features, marked_impairment,
history_mde, substance_medical_excluded)
Arguments
symptom_count |
Numeric. Number of Criterion B symptoms present (e.g., grandiosity, decreased sleep, pressured speech, flight of ideas, distractibility, increased activity, risk-taking). |
irritable_mood_only |
Numeric (0 or 1). Is the mood disturbance characterized ONLY by irritability (without elation/expansiveness)? (1 = Yes). If Yes, the symptom threshold increases from 3 to 4. |
duration_days |
Numeric. Duration of the mood disturbance in days. |
hospitalized |
Numeric (0 or 1). Did the episode require hospitalization? (1 = Yes). |
psychotic_features |
Numeric (0 or 1). Were psychotic features present? (1 = Yes). |
marked_impairment |
Numeric (0 or 1). Did the episode cause marked impairment in social or occupational functioning? (1 = Yes). |
history_mde |
Numeric (0 or 1). Is there a history of at least one Major Depressive Episode? (1 = Yes). Required for Bipolar II diagnosis. |
substance_medical_excluded |
Numeric (0 or 1). Have physiological effects of a substance or another medical condition been ruled out? (1 = Yes). |
Value
A list containing:
Diagnosis |
The provisional diagnosis (Bipolar I, Bipolar II, or Criteria Not Met). |
Current_Episode_Type |
Classification of the current/reported episode (Manic, Hypomanic, or None). |
References
American Psychiatric Association. Diagnostic and Statistical Manual of Mental Disorders. 5th ed. Arlington, VA: American Psychiatric Association; 2013.
Examples
# Example 1: Bipolar I (Manic Episode)
# 3 symptoms, elated mood (irritable=0), 7 days duration, marked impairment
dsm5_bipolar_criteria(3, 0, 7, 0, 0, 1, 1, 1)
# Example 2: Bipolar II (Hypomanic + MDE)
# 4 symptoms, 4 days, no severe features, History of MDE
dsm5_bipolar_criteria(4, 0, 4, 0, 0, 0, 1, 1)
# Example 3: Criteria Not Met (Duration too short)
# 3 symptoms, 2 days, no hospitalization
dsm5_bipolar_criteria(3, 0, 2, 0, 0, 0, 1, 1)
DSM-5 Criteria for Major Depressive Disorder
Description
Evaluates the DSM-5 diagnostic criteria for Major Depressive Disorder (MDD). A diagnosis requires five or more symptoms present during the same 2-week period and representing a change from previous functioning. At least one of the symptoms must be either (1) depressed mood or (2) loss of interest or pleasure.
Usage
dsm5_major_depressive_disorder(depressed_mood, diminished_interest,
weight_change, sleep_disturbance,
psychomotor_change, fatigue, worthlessness_guilt,
diminished_concentration, suicidal_ideation)
Arguments
depressed_mood |
Numeric (0 or 1). Depressed mood most of the day, nearly every day. (1 = Yes). |
diminished_interest |
Numeric (0 or 1). Markedly diminished interest or pleasure in all, or almost all, activities. (1 = Yes). |
weight_change |
Numeric (0 or 1). Significant weight loss/gain or decrease/increase in appetite. (1 = Yes). |
sleep_disturbance |
Numeric (0 or 1). Insomnia or hypersomnia. (1 = Yes). |
psychomotor_change |
Numeric (0 or 1). Psychomotor agitation or retardation (observable by others). (1 = Yes). |
fatigue |
Numeric (0 or 1). Fatigue or loss of energy. (1 = Yes). |
worthlessness_guilt |
Numeric (0 or 1). Feelings of worthlessness or excessive/inappropriate guilt. (1 = Yes). |
diminished_concentration |
Numeric (0 or 1). Diminished ability to think or concentrate, or indecisiveness. (1 = Yes). |
suicidal_ideation |
Numeric (0 or 1). Recurrent thoughts of death, recurrent suicidal ideation without a specific plan, or a suicide attempt/plan. (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met" or "Criteria Not Met". |
Symptom_Count |
Total number of symptoms reported. |
Criteria_Check |
Verification of the core symptom requirement and total count threshold. |
References
American Psychiatric Association. Diagnostic and Statistical Manual of Mental Disorders. 5th ed. Arlington, VA: American Psychiatric Association; 2013.
Examples
# Example 1: Diagnosis Confirmed
# Depressed mood, loss of interest, sleep issues, fatigue,
#concentration issues (5 symptoms, core present)
dsm5_major_depressive_disorder(1, 1, 0, 1, 0, 1, 0, 1, 0)
# Example 2: Criteria Not Met
# 4 symptoms only, despite core symptom being present
dsm5_major_depressive_disorder(1, 0, 1, 1, 0, 1, 0, 0, 0)
DSM-5 Criteria for Posttraumatic Stress Disorder (PTSD)
Description
Evaluates the DSM-5 diagnostic criteria for PTSD. Diagnosis requires specific thresholds of symptoms in four clusters (Intrusion, Avoidance, Negative Alterations in Cognition/Mood, and Arousal/Reactivity) following exposure to a traumatic event, lasting more than 1 month, and causing functional impairment.
Usage
dsm5_ptsd_criteria(exposure_criterion_a, intrusion_count_b, avoidance_count_c,
cognition_mood_count_d, arousal_reactivity_count_e,
duration_gt_1month, distress_impairment,
exclusion_criteria_ruled_out, dissociative_symptoms = 0)
Arguments
exposure_criterion_a |
Numeric (0 or 1). Exposure to actual or threatened death, serious injury, or sexual violence. (1 = Yes). |
intrusion_count_b |
Numeric. Number of intrusion symptoms present (e.g., memories, dreams, flashbacks). (Need >= 1). |
avoidance_count_c |
Numeric. Number of avoidance symptoms present. (Need >= 1). |
cognition_mood_count_d |
Numeric. Number of negative alterations in cognitions and mood present. (Need >= 2). |
arousal_reactivity_count_e |
Numeric. Number of alterations in arousal and reactivity present. (Need >= 2). |
duration_gt_1month |
Numeric (0 or 1). Duration of disturbance is more than 1 month. (1 = Yes). |
distress_impairment |
Numeric (0 or 1). Disturbance causes clinically significant distress or impairment. (1 = Yes). |
exclusion_criteria_ruled_out |
Numeric (0 or 1). Disturbance is not attributable to substance use or other medical condition. (1 = Yes). |
dissociative_symptoms |
Numeric (0 or 1). Presence of depersonalization or derealization. (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met" or "Criteria Not Met". |
Subtype |
Specification if dissociative symptoms are present. |
Missing_Criteria |
List of criteria groups that were not satisfied. |
References
American Psychiatric Association. Diagnostic and Statistical Manual of Mental Disorders. 5th ed. Arlington, VA: American Psychiatric Association; 2013.
Examples
# Example 1: Diagnosis Met
# Stressor(1), 2 Intrusions, 1 Avoidance, 3 Mood, 2 Arousal, >1mo(1), Impaired(1), Exclusions(1)
dsm5_ptsd_criteria(1, 2, 1, 3, 2, 1, 1, 1)
# Example 2: Criteria Not Met (Insufficient Avoidance)
# Stressor(1), 2 Intrusions, 0 Avoidance, 2 Mood, 2 Arousal, >1mo(1), Impaired(1), Exclusions(1)
dsm5_ptsd_criteria(1, 2, 0, 2, 2, 1, 1, 1)
du Bois Score for Idiopathic Pulmonary Fibrosis (IPF) Mortality
Description
Calculates the du Bois score to predict the 1-year risk of mortality in patients with Idiopathic Pulmonary Fibrosis (IPF). The score is based on age, history of respiratory hospitalization, baseline FVC, and the 24-week change in FVC.
Usage
du_bois_ipf_score(age, history_resp_hospitalization, baseline_fvc_percent,
fvc_change_24wk_percent)
Arguments
age |
Numeric. Patient age in years. < 60: 0 pts. 60-69: 4 pts. >= 70: 8 pts. |
history_resp_hospitalization |
Numeric (0 or 1). History of respiratory hospitalization in the past 6 months. (1 = Yes, +14 pts). |
baseline_fvc_percent |
Numeric. Predicted baseline Forced Vital Capacity (FVC) percentage. >= 80: 0 pts. 66-79: 8 pts. 51-65: 13 pts. <= 50: 18 pts. |
fvc_change_24wk_percent |
Numeric. Change in predicted FVC over 24 weeks in percentage points. (e.g., -5 for a 5 >= -4.9: 0 pts (Stable/Improved). -5 to -9.9: 10 pts (Marginal Decline). <= -10: 21 pts (Significant Decline). |
Value
A list containing:
du_Bois_Score |
The calculated risk score (Range 0-61). |
Est_1_Year_Mortality |
Estimated probability of death within 1 year. |
References
du Bois RM, et al. Ascertainment of individual risk of mortality for patients with idiopathic pulmonary fibrosis. Am J Respir Crit Care Med. 2011;184(4):459-466. doi:10.1164/rccm.201011-1790OC
Examples
# Example 1: High Risk
# 72yo (+8), Prior Hosp (+14), FVC 55% (+13), Decline -12% (+21)
# Score = 56
du_bois_ipf_score(72, 1, 55, -12)
# Example 2: Low Risk
# 55yo (0), No Hosp (0), FVC 85% (0), Stable FVC (0)
# Score = 0
du_bois_ipf_score(55, 0, 85, 0)
Duke Activity Status Index (DASI)
Description
Calculates the Duke Activity Status Index (DASI), a self-administered questionnaire that measures a patient's functional capacity. The DASI score (0-58.2) correlates with peak oxygen uptake (VO2 peak), providing an estimate of cardiovascular fitness and functional reserve.
Usage
duke_activity_status_index(self_care, walk_indoors, walk_blocks, climb_stairs,
run_short, light_housework, moderate_housework,
heavy_housework, yard_work, sexual_relations,
moderate_recreation, strenuous_sports)
Arguments
self_care |
Numeric (0 or 1). Can you take care of yourself (eat, dress, bathe, or use the toilet)? |
walk_indoors |
Numeric (0 or 1). Can you walk indoors, such as around your house? |
walk_blocks |
Numeric (0 or 1). Can you walk a block or two on level ground? |
climb_stairs |
Numeric (0 or 1). Can you climb a flight of stairs or walk up a hill? |
run_short |
Numeric (0 or 1). Can you run a short distance? |
light_housework |
Numeric (0 or 1). Can you do light work around the house like dusting or washing dishes? |
moderate_housework |
Numeric (0 or 1). Can you do moderate work around the house like vacuuming, sweeping floors, or carrying groceries? |
heavy_housework |
Numeric (0 or 1). Can you do heavy work around the house like scrubbing floors or lifting or moving heavy furniture? |
yard_work |
Numeric (0 or 1). Can you do yard work like raking leaves, weeding, or pushing a power mower? |
sexual_relations |
Numeric (0 or 1). Can you have sexual relations? |
moderate_recreation |
Numeric (0 or 1). Can you participate in moderate recreational activities like golf, bowling, dancing, doubles tennis, or throwing a baseball or football? |
strenuous_sports |
Numeric (0 or 1). Can you participate in strenuous sports like swimming, singles tennis, football, basketball, or skiing? |
Value
A list containing:
DASI_Score |
The calculated DASI score (Range 0-58.2). |
Estimated_VO2_Peak_mL_kg_min |
Estimated peak oxygen uptake. |
Estimated_METs |
Estimated metabolic equivalents. |
References
Hlatky MA, Boineau RE, Higginbotham MB, et al. A brief self-administered questionnaire to determine functional capacity (the Duke Activity Status Index). Am J Cardiol. 1989;64(10):651-654. doi:10.1016/0002-9149(89)90496-7
Examples
# Example 1: High Capacity
# Can do everything
duke_activity_status_index(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
# Example 2: Low Capacity
# Can only care for self and walk indoors
duke_activity_status_index(1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Modified Duke Criteria for Infective Endocarditis
Description
Calculates the classification (Definite, Possible, or Rejected) for Infective Endocarditis based on the Modified Duke Criteria. This set of diagnostic criteria integrates pathologic, clinical, laboratory, and echocardiographic findings.
Usage
duke_endocarditis_criteria(pathologic_lesions, major_blood_cultures,
major_echo, predisposition_heart_condition,
fever_gt_38, vascular_phenomena,
immunologic_phenomena, minor_blood_culture_findings)
Arguments
pathologic_lesions |
Numeric (0 or 1). Pathologic lesions (vegetation or intracardiac abscess) demonstrating active endocarditis on histology OR microorganisms demonstrated by culture/histology of vegetation/emboli. (1 = Yes). |
major_blood_cultures |
Numeric (0 or 1). Positive blood cultures meeting specific criteria (typical microorganisms consistent with IE from 2 separate cultures, persistent positive cultures, or single positive for Coxiella burnetii). (1 = Yes). |
major_echo |
Numeric (0 or 1). Evidence of endocardial involvement (vegetation, abscess, new partial dehiscence of prosthetic valve, or new valvular regurgitation). (1 = Yes). |
predisposition_heart_condition |
Numeric (0 or 1). Predisposing heart condition or intravenous drug use. (1 = Yes). |
fever_gt_38 |
Numeric (0 or 1). Fever >= 38.0 C (100.4 F). (1 = Yes). |
vascular_phenomena |
Numeric (0 or 1). Major arterial emboli, septic pulmonary infarcts, mycotic aneurysm, intracranial hemorrhage, conjunctival hemorrhages, or Janeway lesions. (1 = Yes). |
immunologic_phenomena |
Numeric (0 or 1). Glomerulonephritis, Osler's nodes, Roth spots, or Rheumatoid factor. (1 = Yes). |
minor_blood_culture_findings |
Numeric (0 or 1). Microbiologic evidence (positive blood culture but does not meet major criteria, or serologic evidence of active infection with organism consistent with IE). (1 = Yes). |
Value
A list containing:
Classification |
"Definite Infective Endocarditis", "Possible Infective Endocarditis", or "Rejected". |
Criteria_Met |
Summary of the counts of Major and Minor criteria identified. |
References
Li JS, Sexton DJ, Mick N, et al. Proposed modifications to the Duke criteria for the diagnosis of infective endocarditis. Clin Infect Dis. 2000;30(4):633-638. doi:10.1086/313753
Examples
# Example 1: Definite IE (1 Major + 3 Minor)
# Major Echo, Fever, Vascular, Immunologic
duke_endocarditis_criteria(0, 0, 1, 0, 1, 1, 1, 0)
# Example 2: Possible IE (3 Minor)
# Fever, Predisposition, Minor Culture
duke_endocarditis_criteria(0, 0, 0, 1, 1, 0, 0, 1)
2023 Duke-ISCVID Criteria for Infective Endocarditis
Description
Calculates the classification for Infective Endocarditis (IE) based on the 2023 Duke-International Society for Cardiovascular Infectious Diseases (ISCVID) Criteria. These criteria update the Modified Duke Criteria (2000) with clarifications on microbiology, new imaging modalities (PET/CT), and expanded lists of predisposing conditions and vascular phenomena.
Classifications returned: - Definite IE: Pathologic criteria OR 2 Major OR 1 Major + 3 Minor OR 5 Minor. - Possible IE: 1 Major + 1 Minor OR 3 Minor. - Rejected IE: Does not meet above criteria.
Usage
duke_iscvid_2023(pathologic_criteria, major_microbiology, major_imaging,
predisposition, fever, vascular, immunologic, minor_microbiology)
Arguments
pathologic_criteria |
Numeric (0 or 1). Pathologic lesions (vegetations/intracardiac abscess) or microorganisms demonstrated by culture/histology/PCR in a cardiac vegetation, embolized vegetation, or intracardiac abscess. |
major_microbiology |
Numeric (0 or 1). Positive blood cultures for IE (typical microorganisms, persistent positives, single positive for C. burnetii, etc.) as defined by ISCVID 2023. |
major_imaging |
Numeric (0 or 1). Echocardiogram positive for IE (vegetation, abscess, perforation, etc.), Cardiac CT, or [18F]FDG-PET/CT showing abnormal metabolic activity. |
predisposition |
Numeric (0 or 1). Predisposing heart condition (prosthetic valve, prior IE, CHD, etc.) or Injection Drug Use (IDU). |
fever |
Numeric (0 or 1). Temperature > 38.0 degrees C. |
vascular |
Numeric (0 or 1). Vascular phenomena: arterial emboli, septic pulmonary infarcts, infectious (mycotic) aneurysm, intracranial hemorrhage, conjunctival hemorrhages, or Janeway's lesions. |
immunologic |
Numeric (0 or 1). Immunologic phenomena: Glomerulonephritis, Osler's nodes, Roth's spots, or Rheumatoid factor. |
minor_microbiology |
Numeric (0 or 1). Positive blood culture that does not meet a major criterion as noted above. |
Value
A list containing the final Classification (Definite, Possible, or Rejected), the Reasoning (rule applied), and a count of Major/Minor criteria met.
References
Fowler VG, Durack DT, Selton-Suty C, et al. The 2023 Duke-ISCVID Criteria for Infective Endocarditis: Updating the Modified Duke Criteria. Clin Infect Dis. 2023;77(4):518-526. doi:10.1093/cid/ciad271
Examples
# Example 1: Definite IE (1 Major + 3 Minor)
# No Pathologic, Major Imaging, Fever, Vascular, Immunologic
duke_iscvid_2023(0, 0, 1, 0, 1, 1, 1, 0)
# Example 2: Possible IE (1 Major + 1 Minor)
# Major Micro, Predisposition only
duke_iscvid_2023(0, 1, 0, 1, 0, 0, 0, 0)
# Example 3: Definite IE via Pathologic Criteria
duke_iscvid_2023(1, 0, 0, 0, 0, 0, 0, 0)
Duke Treadmill Score
Description
Calculates the Duke Treadmill Score (DTS), a widely used prognostic tool for patients undergoing exercise treadmill testing. The score predicts 5-year mortality and stratifies patients into low, moderate, and high-risk categories based on exercise capacity, ST-segment deviation, and exercise-induced angina.
Usage
duke_treadmill_score(exercise_time_min, max_st_depression_mm, angina_index)
Arguments
exercise_time_min |
Numeric. Total exercise time in minutes using the Bruce protocol. |
max_st_depression_mm |
Numeric. Maximum net ST-segment deviation (depression or elevation) in millimeters during or after exercise (relative to baseline). |
angina_index |
Numeric (0, 1, or 2). Exercise-induced angina. 0: No angina. 1: Non-limiting angina (occurred but test continued). 2: Limiting angina (test stopped due to angina). |
Value
A list containing:
Duke_Score |
The calculated DTS score (Range typically -25 to +15). |
Risk_Group |
Classification (Low >= +5, Moderate -10 to +4, High < -10). |
Annual_Mortality_Risk |
Estimated annual mortality rate. |
Five_Year_Survival |
Estimated 5-year survival rate. |
References
Mark DB, Hlatky MA, Harrell FE Jr, et al. Exercise treadmill score for predicting prognosis in coronary artery disease. Ann Intern Med. 1987;106(6):793-800. doi:10.7326/0003-4819-106-6-793
Examples
# Example 1: Low Risk
# 10 minutes exercise, 0mm ST depression, No Angina
# Score = 10 - 0 - 0 = 10
duke_treadmill_score(10, 0, 0)
# Example 2: High Risk
# 3 minutes exercise, 2mm ST depression, Limiting Angina
# Score = 3 - (5*2) - (4*2) = 3 - 10 - 8 = -15
duke_treadmill_score(3, 2, 2)
Dutch Lipid Clinic Network Criteria for Familial Hypercholesterolemia (FH)
Description
Calculates the Dutch Lipid Clinic Network (DLCN) score to assess the likelihood of Familial Hypercholesterolemia (FH) in an individual. The score aggregates points from family history, clinical history, physical examination, LDL cholesterol levels, and DNA analysis.
Usage
dutch_lipid_clinic_score(ldl_cholesterol, family_history_score,
personal_premature_cad,
personal_premature_cerebral_peripheral,
exam_tendon_xanthoma, exam_arcus_cornealis_lt45,
genetic_mutation, ldl_units = "mg/dL")
Arguments
ldl_cholesterol |
Numeric. Pre-treatment LDL cholesterol level. |
family_history_score |
Numeric (0, 1, or 2). Points assigned for family history (choose the highest applicable): 0: None. 1: 1st-degree relative with premature coronary/vascular disease OR 1st-degree relative with LDL >95th percentile. 2: 1st-degree relative with tendon xanthomas/corneal arcus OR Child <18 with LDL >95th percentile. |
personal_premature_cad |
Numeric (0 or 1). Patient has premature coronary artery disease (Men <55, Women <60). (1 = Yes, +2 pts). |
personal_premature_cerebral_peripheral |
Numeric (0 or 1). Patient has premature cerebral or peripheral vascular disease (Men <55, Women <60). (1 = Yes, +1 pt). |
exam_tendon_xanthoma |
Numeric (0 or 1). Tendon xanthomas present on examination. (1 = Yes, +6 pts). |
exam_arcus_cornealis_lt45 |
Numeric (0 or 1). Arcus cornealis present prior to age 45. (1 = Yes, +4 pts). Note: If both xanthoma and arcus are present, usually only the higher score (6) is applied for the exam category. |
genetic_mutation |
Numeric (0 or 1). Functional mutation in LDLR, APOB, or PCSK9 gene present. (1 = Yes, +8 pts). |
ldl_units |
String. Units for LDL input. "mg/dL" (default) or "mmol/L". |
Value
A list containing:
DLCN_Score |
The calculated total score. |
Diagnosis |
Classification (Unlikely <3, Possible 3-5, Probable 6-8, Definite >8). |
References
World Health Organization. Familial hypercholesterolaemia (FH): Report of a second WHO consultation. Geneva. 1999.
Examples
# Example 1: Definite FH
# LDL 350 mg/dL (+8), Tendon Xanthomas (+6)
# Score = 14
dutch_lipid_clinic_score(350, 0, 0, 0, 1, 0, 0)
# Example 2: Possible FH
# LDL 160 mg/dL (+1), Premature CAD (+2)
# Score = 3
dutch_lipid_clinic_score(160, 0, 1, 0, 0, 0, 0)
Duval/CIBMTR Score for AML Survival
Description
Calculates the Duval/CIBMTR score to predict 3-year overall survival in patients with active Acute Myelogenous Leukemia (AML) undergoing hematopoietic cell transplantation (HCT). The score stratifies patients based on disease status, cytogenetics, donor match, circulating blasts, and performance status.
Usage
duval_cibmtr_aml_survival(disease_group, cytogenetics, hla_match,
circulating_blasts, karnofsky_score)
Arguments
disease_group |
Numeric (0 or 1). Disease status group. 0: Primary induction failure OR Duration of first complete remission > 6 months. 1: Duration of first complete remission < 6 months (or relapse within 6 months). |
cytogenetics |
Numeric (0 or 1). Cytogenetic risk group. 0: Good or Intermediate. 1: Poor. |
hla_match |
Numeric (0 or 1). Donor HLA match type. 0: HLA-identical sibling or well-matched/partially-matched unrelated donor. 1: Mismatched unrelated donor or related other than HLA-identical sibling. (+2 points). |
circulating_blasts |
Numeric (0 or 1). Presence of circulating blasts at the time of transplant. (1 = Present, +1 point). |
karnofsky_score |
Numeric (0 or 1). Karnofsky Performance Status (KPS) or Lansky scale. 0: 90-100. 1: < 90. (+1 point). |
Value
A list containing:
Duval_CIBMTR_Score |
The calculated score (Range 0-6). |
Estimated_3_Year_Survival |
The predicted 3-year overall survival probability. |
References
Duval M, Klein JP, He W, et al. Hematopoietic stem-cell transplantation for acute leukemia in relapse or primary induction failure. J Clin Oncol. 2010;28(23):3730-3738. doi:10.1200/JCO.2010.28.8852
Examples
# Example 1: Good Prognosis
# CR1 > 6mo (0), Good Cyto (0), Matched Sib (0), No Blasts (0), KPS 90 (0)
# Score = 0
duval_cibmtr_aml_survival(0, 0, 0, 0, 0)
# Example 2: Poor Prognosis
# CR1 < 6mo (1), Poor Cyto (1), Mismatched Donor (1 -> +2pts), Blasts Present (1), KPS 80 (1)
# Score = 1 + 1 + 2 + 1 + 1 = 6
duval_cibmtr_aml_survival(1, 1, 1, 1, 1)
Calculate eAG (Estimated Average Glucose)
Description
Using HbA1C (hemoglobin A1C) levels, estimate the average amount of glucose in one's body, derived by Nathan et al. 2008. Usage represents the average glucose level for a cumulative period of 3 months and has been shown to conocordant with fasting glucose levels. HbA1C levels range between 4-5.6 in non-diabetic populations.
Usage
eAG(a1c)
Arguments
a1c |
Numeric value of percent glycolated hemoglobin (HbA1C). |
Value
A numeric value/vector with predicted level of estimated average glucose.
References
Nathan DM, Kuenen J, Borg R, et al. Translating the A1C assay into estimated average glucose values [published correction appears in Diabetes Care. 2009 Jan;32(1):207]. Diabetes Care. 2008;31(8):1473-1478. doi:10.2337/dc08-0545
Examples
# The function is defined as
eAG(4)
Eczema Area and Severity Index (EASI)
Description
Calculates the EASI score, a tool used to measure the extent (area) and severity of atopic dermatitis (eczema). The body is divided into four regions (Head/Neck, Upper Limbs, Trunk, Lower Limbs), and weighted based on age (<8 years vs >=8 years).
Usage
easi_score(age_years, area_scores, erythema_scores, induration_scores,
excoriation_scores, lichenification_scores)
Arguments
age_years |
Numeric. Patient age in years. Determines the body region weighting multipliers. |
area_scores |
Numeric Vector (length 4). Area involvement score for [Head, Upper, Trunk, Lower]. 0: 0% 1: 1-9% 2: 10-29% 3: 30-49% 4: 50-69% 5: 70-89% 6: 90-100% |
erythema_scores |
Numeric Vector (length 4). Redness severity (0-3) for each region. |
induration_scores |
Numeric Vector (length 4). Thickness/Papulation severity (0-3) for each region. |
excoriation_scores |
Numeric Vector (length 4). Scratching severity (0-3) for each region. |
lichenification_scores |
Numeric Vector (length 4). Lined skin severity (0-3) for each region. |
Value
A list containing:
EASI_Score |
The calculated total score (Range 0-72). |
Severity_Category |
Classification (Clear, Almost Clear, Mild, Moderate, Severe, Very Severe). |
References
Hanifin JM, Thurston M, Omoto M, et al. The eczema area and severity index (EASI): assessment of reliability in atopic dermatitis. EASI Evaluator Group. Exp Dermatol. 2001;10(1):11-18. doi:10.1034/j.1600-0625.2001.100102.x Leshem YA, Hajar T, Hanifin JM, Simpson EL. What the Eczema Area and Severity Index score tells us about the severity of atopic dermatitis: an interpretability study. Br J Dermatol. 2015;172(5):1353-1357.
Examples
# Example 1: Adult with Moderate Eczema
# Age 30
# Area scores: Head(1), Upper(2), Trunk(2), Lower(3)
# Erythema: 1, 2, 2, 2
# Induration: 1, 1, 2, 2
# Excoriation: 1, 2, 1, 2
# Lichenif: 0, 1, 1, 2
easi_score(30, c(1, 2, 2, 3), c(1, 2, 2, 2), c(1, 1, 2, 2), c(1, 2, 1, 2), c(0, 1, 1, 2))
# Example 2: Child (<8) with Severe Eczema
# Age 5 (Different multipliers)
# High scores across all regions
easi_score(5, c(4, 4, 5, 5), c(3, 3, 3, 3), c(2, 2, 3, 3), c(2, 3, 3, 3), c(1, 2, 2, 2))
Eat, Sleep, Console (ESC) Assessment for NAS
Description
Calculates the Eat, Sleep, Console (ESC) score to assist in the management of infants with Neonatal Abstinence Syndrome (NAS) or Neonatal Opioid Withdrawal Syndrome (NOWS). This functional assessment prioritizes non-pharmacologic care and family involvement over traditional scoring systems like Finnegan.
Usage
eat_sleep_console_score(eating_well, sleeping_well, easy_to_console)
Arguments
eating_well |
Numeric (0 or 1). Can the infant eat >= 1 ounce per feed or breastfeed well? (1 = Yes). |
sleeping_well |
Numeric (0 or 1). Can the infant sleep >= 1 hour continuously? (1 = Yes). |
easy_to_console |
Numeric (0 or 1). Can the infant be consoled within 10 minutes? (1 = Yes). |
Value
A list containing:
ESC_Total_Score |
The sum of positive criteria met (Range 0-3). |
Recommendation |
Clinical guidance based on whether all functional criteria are met. |
References
Grossman MR, Berkwitt AK, Osborn RR, et al. An Initiative to Improve the Quality of Care of Infants With Neonatal Abstinence Syndrome. Pediatrics. 2017;139(6):e20163360. doi:10.1542/peds.2016-3360
Examples
# Example 1: Well Managed
# Eating well, sleeping well, easy to console
eat_sleep_console_score(1, 1, 1)
# Example 2: Intervention Needed
# Poor feeding, poor sleep, hard to console
eat_sleep_console_score(0, 0, 0)
# Example 3: Intervention Needed
# Eating well, sleeping well, but hard to console
eat_sleep_console_score(1, 1, 0)
Eastern Cooperative Oncology Group (ECOG) Performance Status
Description
Retrieves the definition for the ECOG Performance Status grade. This scale is used by doctors and researchers to assess how a patient's disease is progressing, assess how the disease affects the daily living abilities of the patient, and determine appropriate treatment and prognosis.
Usage
ecog_performance_status(grade)
Arguments
grade |
Numeric (0-5). The assigned performance status grade. 0: Fully active. 1: Restricted strenuous activity, ambulatory. 2: Ambulatory, self-care, no work. 3: Limited self-care, >50% bed/chair. 4: Completely disabled. 5: Dead. |
Value
A list containing:
ECOG_Grade |
The input grade. |
Definition |
The clinical description associated with the grade. |
References
Oken MM, Creech RH, Tormey DC, et al. Toxicity and response criteria of the Eastern Cooperative Oncology Group. Am J Clin Oncol. 1982;5(6):649-655. doi:10.1097/00000421-198212000-00014
Examples
# Example 1: Ambulatory patient unable to work
ecog_performance_status(2)
# Example 2: Fully active patient
ecog_performance_status(0)
Emergency Department Assessment of Chest Pain Score (EDACS)
Description
Calculates the EDACS Score to identify chest pain patients with a low risk of Major Adverse Cardiac Events (MACE) who may be safe for early discharge. The full EDACS-ADP (Accelerated Diagnostic Protocol) incorporates the score (< 16), lack of new ischemia on EKG, and negative troponin measurements at 0 and 2 hours.
Usage
edacs_chest_pain_score(age, sex, known_cad_or_3_risk_factors, diaphoresis,
radiation, pain_inspiration, pain_palpation,
ekg_ischemia_present = FALSE, troponin_normal = TRUE)
Arguments
age |
Numeric. Patient age in years (must be >= 18). |
sex |
String. Patient sex ("Male" or "Female"). Male sex adds +6 points. |
known_cad_or_3_risk_factors |
Numeric (0 or 1). Does the patient have known Coronary Artery Disease (CAD) OR >= 3 risk factors (Age 45-65M/55-65F, Dyslipidemia, Diabetes, Hypertension, Current Smoker, Family History)? (1 = Yes, +4 points). |
diaphoresis |
Numeric (0 or 1). Presence of diaphoresis. (1 = Yes, +3 points). |
radiation |
Numeric (0 or 1). Pain radiates to arm, shoulder, neck, or jaw. (1 = Yes, +5 points). |
pain_inspiration |
Numeric (0 or 1). Pain occurs or worsens with inspiration. (1 = Yes, -4 points). |
pain_palpation |
Numeric (0 or 1). Pain is reproduced by palpation. (1 = Yes, -6 points). |
ekg_ischemia_present |
Numeric (0 or 1). New ischemia on ECG. (1 = Yes). Required for full protocol assessment. |
troponin_normal |
Numeric (0 or 1). Are 0h and 2h troponin levels negative? (1 = Yes). Required for full protocol assessment. |
Value
A list containing:
EDACS_Score |
The calculated score (Range -10 to +50 range possible depending on inputs). |
Risk_Category |
"Low Risk" if Score < 16 AND no EKG ischemia AND normal troponins; otherwise "Not Low Risk". |
Recommendation |
Guidance on discharge vs. observation. |
References
Than M, Flaws D, Sanders S, et al. Development and validation of the Emergency Department Assessment of Chest pain Score and 2h accelerated diagnostic protocol. Emerg Med Australas. 2014;26(1):34-44. doi:10.1111/1742-6723.12164
Examples
# Example 1: Low Risk Patient
# 40yo Female (2), No Hx (0), No Diaphoresis (0), No Radiation (0),
# Pain with Inspiration (-4), Palpation (-6) -> Score = -8
# Normal EKG, Normal Troponin
edacs_chest_pain_score(40, "female", 0, 0, 0, 1, 1, 0, 1)
# Example 2: High Risk Patient
# 65yo Male (10+6=16), Known CAD (+4), Diaphoresis (+3) -> Score = 23
edacs_chest_pain_score(65, "male", 1, 1, 0, 0, 0, 0, 1)
Edinburgh Gastric Ulcer Score (EGUS)
Description
Calculates the Edinburgh Gastric Ulcer Score (EGUS) to assess the risk of malignancy in patients with gastric ulcers and determine the need for repeat endoscopic surveillance. The score is derived from patient age, ulcer size, and ulcer location.
Usage
edinburgh_gastric_ulcer_score(age, ulcer_size_cm, ulcer_location)
Arguments
age |
Numeric. Patient age in years. < 68: 0 points. 68-79: 1 point. >= 80: 2 points. |
ulcer_size_cm |
Numeric. Size of the ulcer in centimeters. < 1.25 cm: 0 points. 1.25 - 2.99 cm: 2 points. >= 3.00 cm: 3 points. |
ulcer_location |
String. Location of the ulcer: "antral" (0 points) or "non-antral" (1 point). |
Value
A list containing:
EGUS_Score |
The calculated risk score (Range 0-6). |
Risk_Category |
Classification (Low Risk: 0-2, High Risk: >=3). |
Recommendation |
Clinical guidance regarding the necessity of repeat endoscopy. |
References
Grant RK, Brindle W, Cameron E, et al. Risk stratifying gastric ulcers: development and validation of a scoring system. Gut. 2021.
Examples
# Example 1: High Risk
# 70yo (+1), 2.0cm ulcer (+2), Non-antral (+1)
# Score = 4
edinburgh_gastric_ulcer_score(70, 2.0, "non-antral")
# Example 2: Low Risk
# 50yo (0), 0.5cm ulcer (0), Antral (0)
# Score = 0
edinburgh_gastric_ulcer_score(50, 0.5, "antral")
Edmonton Obesity Staging System (EOSS)
Description
Calculates the EOSS Stage to classify obesity based on the presence and severity of risk factors, comorbidities, and functional limitations. Unlike BMI, which measures size, EOSS measures the impact of obesity on health, guiding clinical management from prevention to palliative care.
Usage
edmonton_obesity_staging_system(severe_functional_limitations, end_organ_damage,
established_comorbidity, subclinical_risk_factors)
Arguments
severe_functional_limitations |
Numeric (0 or 1). Presence of severe (end-stage) disabilities or severe psychopathology. (1 = Yes). |
end_organ_damage |
Numeric (0 or 1). Presence of established end-organ damage (e.g., myocardial infarction, heart failure, diabetic complications, stroke). (1 = Yes). |
established_comorbidity |
Numeric (0 or 1). Presence of established obesity-related chronic disease (e.g., hypertension, type 2 diabetes, sleep apnea, osteoarthritis) or moderate functional limitations. (1 = Yes). |
subclinical_risk_factors |
Numeric (0 or 1). Presence of subclinical risk factors (e.g., borderline hypertension, impaired fasting glucose, elevated liver enzymes) or mild physical symptoms. (1 = Yes). |
Value
A list containing:
EOSS_Stage |
The calculated stage (0, 1, 2, 3, or 4). |
Description |
Clinical definition of the stage. |
Management_Recommendation |
Guideline-based management strategy. |
References
Sharma AM, Kushner RF. A proposed clinical staging system for obesity. Int J Obes (Lond). 2009;33(3):289-295. doi:10.1038/ijo.2009.2
Examples
# Example 1: Stage 2 (Established Disease)
# Patient has Type 2 Diabetes and Hypertension, no end-organ damage
edmonton_obesity_staging_system(0, 0, 1, 1)
# Example 2: Stage 0 (Metabolically Healthy)
# No risk factors or symptoms identified
edmonton_obesity_staging_system(0, 0, 0, 0)
EGSYS Score for Cardiac Syncope
Description
Calculates the EGSYS (Evaluation of Guidelines in Syncope Study) Score to stratify patients with syncope. This score helps differentiate between cardiac syncope (higher mortality risk) and neurally mediated/reflex syncope. A score of 3 or higher suggests a cardiac etiology.
Usage
egsys_syncope_score(palpitations, abnormal_ecg_or_heart_disease,
effort_syncope, supine_syncope, autonomic_prodrome,
predisposing_factors)
Arguments
palpitations |
Numeric (0 or 1). Palpitations preceding the syncopal event. (1 = Yes, +4 points). |
abnormal_ecg_or_heart_disease |
Numeric (0 or 1). Abnormal ECG and/or history of structural heart disease. (1 = Yes, +3 points). |
effort_syncope |
Numeric (0 or 1). Syncope occurred during effort/exertion. (1 = Yes, +3 points). |
supine_syncope |
Numeric (0 or 1). Syncope occurred while supine. (1 = Yes, +2 points). |
autonomic_prodrome |
Numeric (0 or 1). Presence of autonomic prodrome (e.g., nausea, vomiting). (1 = Yes, -1 point). |
predisposing_factors |
Numeric (0 or 1). Presence of predisposing factors (e.g., warm crowded place, prolonged standing, fear/pain/emotion). (1 = Yes, -1 point). |
Value
A list containing:
EGSYS_Score |
The calculated total score (Range -2 to 12). |
Interpretation |
Risk stratification regarding cardiac vs. non-cardiac cause. |
Likely_Etiology |
"Likely Cardiac Syncope" (Score >= 3) or "Likely Neurally Mediated Syncope" (Score < 3). |
References
Del Rosso A, Ungar A, Maggi R, et al. Clinical predictors of cardiac syncope at initial evaluation in patients referred urgently to a general hospital: the EGSYS Score. Heart. 2008;94(12):1620-1626. doi:10.1136/hrt.2008.143149
Examples
# Example 1: High Risk (Cardiac)
# Palpitations (+4), Heart Disease (+3), No prodrome
# Score = 7
egsys_syncope_score(1, 1, 0, 0, 0, 0)
# Example 2: Low Risk (Neurally Mediated)
# Warm crowded room (-1), Nausea (-1), No cardiac features
# Score = -2
egsys_syncope_score(0, 0, 0, 0, 1, 1)
Emergency Heart Failure Mortality Risk Grade (EHMRG)
Description
Calculates the EHMRG score to predict 7-day mortality in patients presenting to the Emergency Department with acute heart failure. The score integrates vital signs, age, renal function, potassium, troponin status, and active cancer history to risk-stratify patients for disposition decisions (discharge vs. admission).
Usage
ehmrg_mortality_score(age, sbp, heart_rate, o2_sat, creatinine, potassium,
troponin_positive, active_cancer, creatinine_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. |
sbp |
Numeric. Systolic Blood Pressure (mmHg). (Lower SBP increases risk). |
heart_rate |
Numeric. Heart rate (bpm). (Higher HR increases risk). |
o2_sat |
Numeric. Oxygen saturation (%). (Lower saturation increases risk). |
creatinine |
Numeric. Serum Creatinine. |
potassium |
Numeric. Serum Potassium (mEq/L). |
troponin_positive |
Numeric (0 or 1). Positive Troponin result. (1 = Yes). |
active_cancer |
Numeric (0 or 1). Active cancer history. (1 = Yes). |
creatinine_units |
String. Units for creatinine. "mg/dL" (default) or "micromol/L". |
Value
A list containing:
EHMRG_Score |
The calculated risk score. |
Risk_Classification |
Risk tier (Low, Intermediate, High, Very High). |
Est_7_Day_Mortality |
Estimated 7-day mortality risk. |
References
Lee DS, Stitt A, Austin PC, et al. Prediction of heart failure mortality in emergent care: a cohort study. Ann Intern Med. 2012;156(11):767-775. doi:10.7326/0003-4819-156-11-201206050-00003
Examples
# Example 1: High Risk
# 85yo, SBP 100, HR 110, O2 88, Cr 2.0, K 4.8, Trop Pos, Cancer Yes
ehmrg_mortality_score(85, 100, 110, 88, 2.0, 4.8, 1, 1)
# Example 2: Low Risk
# 50yo, SBP 150, HR 70, O2 98, Cr 0.9, K 3.8, Trop Neg, No Cancer
ehmrg_mortality_score(50, 150, 70, 98, 0.9, 3.8, 0, 0)
El-Ganzouri Risk Index (EGRI) for Difficult Airway
Description
Calculates the El-Ganzouri Risk Index (EGRI) to estimate the probability of difficult tracheal intubation. The score ranges from 0 to 12, with a score of 4 or higher indicating a significant risk for difficult intubation.
Usage
el_ganzouri_risk_index(mouth_opening_cm, thyromental_distance_cm, mallampati_score,
neck_movement_degrees, can_prognath, weight_kg,
history_difficult_intubation)
Arguments
mouth_opening_cm |
Numeric. Inter-incisor gap in centimeters. (>=4: 0 pts, <4: 1 pt). |
thyromental_distance_cm |
Numeric. Thyromental distance in centimeters. (>6.5: 0 pts, 6.0-6.5: 1 pt, <6.0: 2 pts). |
mallampati_score |
Numeric (1-4). Modified Mallampati Classification. (I-II: 0 pts, III: 1 pt, IV: 2 pts). |
neck_movement_degrees |
Numeric. Range of neck motion in degrees. (>90: 0 pts, 80-90: 1 pt, <80: 2 pts). |
can_prognath |
Numeric (0 or 1). Ability to protrude jaw (prognath). (1 = Yes: 0 pts, 0 = No: 1 pt). |
weight_kg |
Numeric. Patient body weight in kilograms. (<90: 0 pts, 90-110: 1 pt, >110: 2 pts). |
history_difficult_intubation |
String. History of difficult intubation. Options: "none" (0 pts), "questionable" (1 pt), "definite" (2 pts). |
Value
A list containing:
EGRI_Score |
The calculated total score (Range 0-12). |
Risk_Category |
Classification (Low Risk < 4, High Risk >= 4). |
References
El-Ganzouri AR, McCarthy RJ, Tuman KJ, Tanck EN, Ivankovich AD. Preoperative airway assessment: predictive value of a multivariate risk index. Anesth Analg. 1996;82(6):1197-1204. doi:10.1097/00000539-199606000-00017
Examples
# Example 1: High Risk
# Small mouth, short TMD, Mallampati 3, limited neck, heavy, prior difficulty
# Score = 1 + 2 + 1 + 1 + 1 + 2 + 2 = 10
el_ganzouri_risk_index(3.5, 5.5, 3, 85, 0, 120, "definite")
# Example 2: Low Risk
# Normal anatomy
# Score = 0
el_ganzouri_risk_index(5, 8, 1, 100, 1, 70, "none")
2023 Emergency Medicine Coding Guide (CPT 99281-99285)
Description
Calculates the appropriate CPT Evaluation and Management (E/M) code for Emergency Department visits based on the 2023 AMA CPT guidelines. The selection is driven entirely by Medical Decision Making (MDM), which comprises three components: 1. Number and Complexity of Problems Addressed (COPA). 2. Risk of Complications and/or Morbidity or Mortality of Patient Management. 3. Amount and/or Complexity of Data to be Reviewed and Analyzed.
The final code is determined by the "2 out of 3" rule: the code corresponds to the MDM level met or exceeded by at least two of the three components.
Usage
em_coding_2023(problem_complexity, risk_level, tests_ordered = 0, tests_reviewed = 0,
prior_notes_reviewed = 0, independent_historian = 0,
independent_interpretation = 0, discussion_management = 0)
Arguments
problem_complexity |
String. Description of the patient's problem complexity. Matches MDCalc categories (e.g., "chronic illness w/severe exacerbation", "1 acute uncomplicated illness", "2 minor problems"). The function performs keyword matching to identify the severity level (Minimal, Low, Moderate, High). |
risk_level |
String. The risk level of patient management decisions. Accepted values: "High", "Moderate", "Low", "Minimal". |
tests_ordered |
Numeric (0, 1, 2, or 3). Number of unique tests ordered (e.g., Labs, CT, EKG). Input 3 if >= 3. |
tests_reviewed |
Numeric (0, 1, 2, or 3). Number of unique test results reviewed. Input 3 if >= 3. |
prior_notes_reviewed |
Numeric (0, 1, 2, or 3). Number of unique prior external notes reviewed. Input 3 if >= 3. |
independent_historian |
Numeric (0 or 1). Was an independent historian (e.g., parent, EMS, spouse) required? 1 = Yes, 0 = No. |
independent_interpretation |
Numeric (0 or 1). Did the provider perform an independent interpretation of a test (not separately billed)? 1 = Yes, 0 = No. |
discussion_management |
Numeric (0 or 1). Was there discussion of management or test interpretation with an external physician or qualified healthcare professional? 1 = Yes, 0 = No. |
Value
A list containing:
CPT_Code |
The calculated CPT code (99282, 99283, 99284, or 99285). |
MDM_Level |
The overall Medical Decision Making level (Straightforward, Low, Moderate, High). |
Component_Scores |
The calculated level for each individual component (COPA, Risk, Data). |
Data_Breakdown |
Internal counts used to determine the Data complexity level. |
References
American Medical Association. CPT® Evaluation and Management (E/M) Code and Guideline Changes. 2023. ACEP. 2023 Emergency Department Evaluation and Management Guidelines.
Examples
# Example 1: 99285 (High Complexity)
# Severe exacerbation (High COPA), Prescription management (Moderate Risk),
# but Extensive Data (3 tests + Independent Historian + Discussion)
em_coding_2023(
problem_complexity = "chronic illness w/severe exacerbation",
risk_level = "Moderate",
tests_ordered = 3,
independent_historian = 1,
discussion_management = 1
)
# Example 2: 99284 (Moderate Complexity)
# Acute systemic illness (Moderate COPA), Prescription drug (Moderate Risk),
# Minimal Data
em_coding_2023(
problem_complexity = "acute illness w/systemic sx",
risk_level = "Moderate",
tests_ordered = 1
)
EMBED Buprenorphine Initiation Decision Support
Description
Provides clinical decision support for initiating buprenorphine in the Emergency Department for patients with Opioid Use Disorder (OUD). The algorithm evaluates OUD diagnosis, treatment readiness, withdrawal severity (COWS score), pregnancy status, and provider waiver status to recommend appropriate actions (initiation, home induction, or referral).
Usage
embed_buprenorphine_initiation(oud_present, treatment_readiness,
withdrawal_severity_cows, pregnant, waiver_status)
Arguments
oud_present |
Numeric (0 or 1). Does the patient meet DSM-5 criteria for Opioid Use Disorder? (1 = Yes). |
treatment_readiness |
Numeric (0 or 1). Is the patient ready to start treatment today? (1 = Yes). |
withdrawal_severity_cows |
Numeric. The patient's Clinical Opiate Withdrawal Scale (COWS) score. |
pregnant |
Numeric (0 or 1). Is the patient pregnant? (1 = Yes). |
waiver_status |
Numeric (0 or 1). Does the provider have a waiver (X-waiver) to prescribe buprenorphine? (1 = Yes). Note: Recent US legislation removed the X-waiver requirement, but local protocols may vary. |
Value
A list containing:
Recommendation |
Clinical guidance on whether to initiate, observe, or refer. |
References
Melnick ER, et al. User-centered clinical decision support to implement initiation of buprenorphine for opioid use disorder in the emergency department: EMBED pragmatic cluster randomized controlled trial. BMJ. 2022;377:e069271.
Examples
# Example 1: Ready for Induction
# OUD Yes, Ready Yes, COWS 10 (Moderate), Not Pregnant, Waiver Yes
embed_buprenorphine_initiation(1, 1, 10, 0, 1)
# Example 2: Precipitated Withdrawal Risk
# OUD Yes, Ready Yes, COWS 4 (Mild), Not Pregnant, Waiver Yes
embed_buprenorphine_initiation(1, 1, 4, 0, 1)
Edinburgh Postnatal Depression Scale (EPDS)
Description
Calculates the EPDS score, a 10-item screening tool used to identify women who may have postpartum depression. Each item is scored 0, 1, 2, or 3 based on the intensity of symptoms over the past 7 days. Item 10 specifically screens for suicidal ideation.
Usage
epds_score(q1_laugh, q2_enjoy, q3_blame, q4_anxious, q5_scared, q6_coping,
q7_sleep, q8_sad, q9_crying, q10_self_harm)
Arguments
q1_laugh |
Numeric (0-3). "I have been able to laugh and see the funny side of things." (0=As much as always, 3=Not at all). |
q2_enjoy |
Numeric (0-3). "I have looked forward with enjoyment to things." (0=As much as ever, 3=Hardly at all). |
q3_blame |
Numeric (0-3). "I have blamed myself unnecessarily when things went wrong." (0=Never, 3=Yes, most of the time). |
q4_anxious |
Numeric (0-3). "I have been anxious or worried for no good reason." (0=No, not at all, 3=Yes, very often). |
q5_scared |
Numeric (0-3). "I have felt scared or panicky for no very good reason." (0=No, not at all, 3=Yes, quite a lot). |
q6_coping |
Numeric (0-3). "Things have been getting on top of me." (0=No, I have been coping as well as ever, 3=Yes, most of the time I haven't been able to cope). |
q7_sleep |
Numeric (0-3). "I have been so unhappy that I have had difficulty sleeping." (0=No, not at all, 3=Yes, most of the time). |
q8_sad |
Numeric (0-3). "I have felt sad or miserable." (0=No, not at all, 3=Yes, most of the time). |
q9_crying |
Numeric (0-3). "I have been so unhappy that I have been crying." (0=No, never, 3=Yes, most of the time). |
q10_self_harm |
Numeric (0-3). "The thought of harming myself has occurred to me." (0=Never, 1=Hardly ever, 2=Sometimes, 3=Yes, quite often). **Note:** Any score > 0 on this item suggests immediate risk. |
Value
A list containing:
EPDS_Total_Score |
The sum of the 10 items (Range 0-30). |
Interpretation |
Risk category (Not likely, Possible, Probable). |
Suicide_Risk_Flag |
Boolean indicating if Q10 was positive. |
Action_Plan |
Suggested clinical next steps. |
References
Cox JL, Holden JM, Sagovsky R. Detection of postnatal depression. Development of the 10-item Edinburgh Postnatal Depression Scale. Br J Psychiatry. 1987;150:782-786. doi:10.1192/bjp.150.6.782
Examples
# Example 1: High Risk (Probable Depression + Self Harm)
# High scores on sadness, coping, and self-harm
epds_score(1, 2, 2, 2, 2, 3, 2, 3, 2, 1)
# Example 2: Low Risk
# Mostly 0s and 1s
epds_score(0, 0, 1, 0, 1, 0, 0, 1, 0, 0)
Eosinophilic Esophagitis Endoscopic Reference Score (EREFS)
Description
Calculates the EREFS score, a standardized grading system for endoscopic findings in Eosinophilic Esophagitis (EoE). The score quantifies the severity of five major endoscopic features: Edema, Rings, Exudates, Furrows, and Strictures. It also provides subscores for inflammatory (Edema, Exudates, Furrows) and fibrostenotic (Rings, Stricture) features.
Usage
erefs_score(edema, rings, exudates, furrows, stricture)
Arguments
edema |
Numeric (0-1). Presence of edema (loss of vascular markings). 0: Absent (distinct vascularity). 1: Present (decreased or absent vascularity/pallor). |
rings |
Numeric (0-3). Presence of trachealization/rings. 0: Absent. 1: Mild (ridges). 2: Moderate (distinct rings). 3: Severe (fixed rings, prevents scope passage). |
exudates |
Numeric (0-2). Presence of white plaques/exudates. 0: Absent. 1: Mild (<10% of surface area). 2: Severe (>10% of surface area). |
furrows |
Numeric (0-2). Presence of vertical lines/furrows. 0: Absent. 1: Mild (vertical lines without visible depth). 2: Severe (vertical lines with visible depth). |
stricture |
Numeric (0-1). Presence of stricture (narrowing). 0: Absent. 1: Present. |
Value
A list containing:
EREFS_Total_Score |
The sum of all component scores (Range 0-9). |
Subscores |
A list containing the Inflammatory Score (Range 0-5) and Fibrostenotic Score (Range 0-4). |
References
Hirano I, Moy N, Heckman MG, Thomas CS, Gonsalves N, Achem SR. Endoscopic assessment of the oesophageal features of eosinophilic oesophagitis: validation of a novel classification and grading system. Gut. 2013;62(4):489-495. doi:10.1136/gutjnl-2011-301817
Examples
# Example 1: Mixed Phenotype
# Edema(1), Rings(2), Exudates(1), Furrows(1), Stricture(0)
# Total = 5 (Inflammatory 3, Fibrostenotic 2)
erefs_score(1, 2, 1, 1, 0)
# Example 2: Severe Inflammatory
# Edema(1), Rings(0), Exudates(2), Furrows(2), Stricture(0)
# Total = 5 (Inflammatory 5, Fibrostenotic 0)
erefs_score(1, 0, 2, 2, 0)
Edmonton Symptom Assessment System (Revised) (ESAS-r)
Description
Calculates the total distress score and categorizes symptom severity for the ESAS-r. This tool is designed to assist in the assessment of nine common symptoms in palliative care patients: Pain, Tiredness, Drowsiness, Nausea, Lack of Appetite, Shortness of Breath, Depression, Anxiety, and Wellbeing.
Usage
esas_r_assessment(pain, tiredness, drowsiness, nausea, lack_of_appetite,
shortness_of_breath, depression, anxiety, wellbeing,
other_symptom_score = NULL)
Arguments
pain |
Numeric (0-10). 0 = No Pain, 10 = Worst Possible Pain. |
tiredness |
Numeric (0-10). 0 = Not Tired, 10 = Worst Possible Tiredness. |
drowsiness |
Numeric (0-10). 0 = Not Drowsy, 10 = Worst Possible Drowsiness. |
nausea |
Numeric (0-10). 0 = No Nausea, 10 = Worst Possible Nausea. |
lack_of_appetite |
Numeric (0-10). 0 = Good Appetite, 10 = Worst Possible Appetite. |
shortness_of_breath |
Numeric (0-10). 0 = No Shortness of Breath, 10 = Worst Possible Shortness of Breath. |
depression |
Numeric (0-10). 0 = No Depression, 10 = Worst Possible Depression. |
anxiety |
Numeric (0-10). 0 = No Anxiety, 10 = Worst Possible Anxiety. |
wellbeing |
Numeric (0-10). 0 = Best Wellbeing, 10 = Worst Possible Wellbeing. |
other_symptom_score |
Numeric (0-10) (Optional). Score for an additional patient-identified symptom (e.g., Constipation). |
Value
A list containing:
Total_Symptom_Distress_Score |
Sum of all symptom scores (Range 0-90+). |
Subscores |
Breakdown of Physical (6 items) and Emotional (2 items) distress. |
Severity_Profile |
Categorization of each symptom as None (0), Mild (1-3), Moderate (4-6), or Severe (7-10). |
References
Bruera E, Kuehn N, Miller MJ, Selmser P, Macmillan K. The Edmonton Symptom Assessment System (ESAS): a simple method for the assessment of palliative care patients. J Palliat Care. 1991;7(2):6-9. Watanabe SM, et al. Necrotizing fasciitis: The Edmonton Symptom Assessment System-revised (ESAS-r). Palliative Medicine. 2011.
Examples
# Example 1: High Distress
# Severe Pain(8), Tiredness(7), Anxiety(6), others mild
esas_r_assessment(8, 7, 2, 1, 5, 2, 4, 6, 5)
# Example 2: Low Distress
# All items 0 or 1
esas_r_assessment(1, 0, 0, 0, 1, 0, 0, 0, 1)
Estimated Serum Concentration for Toxic Alcohols
Description
Calculates the theoretical peak serum concentration of Ethanol, Methanol, Ethylene Glycol, or Isopropanol following an acute ingestion. The estimation uses the Widmark formula variant:
Cp = \frac{Volume \times Concentration \times SpecificGravity}{Weight \times Vd}
where Cp is the peak concentration.
Usage
estimate_toxic_alcohol_level(substance, volume_ingested, volume_units,
concentration_percent, weight_kg, sex = "male")
Arguments
substance |
String. The ingested substance. Options: "ethanol", "methanol", "ethylene_glycol", "isopropanol". |
volume_ingested |
Numeric. The volume of liquid ingested. |
volume_units |
String. Units of volume. Options: "mL", "oz", "L". |
concentration_percent |
Numeric. The concentration of the substance in percent (e.g., 40 for 80-proof vodka, 95 for antifreeze). |
weight_kg |
Numeric. Patient weight in kilograms. |
sex |
String. Patient sex ("Male" or "Female"). Primarily affects the Volume of Distribution (Vd) used for Ethanol calculations. |
Value
A list containing:
Estimated_Peak_Concentration_mg_dL |
The calculated peak serum level in mg/dL. |
Interpretation |
Clinical context regarding toxic thresholds (e.g., treatment indication for methanol/ethylene glycol at >20 mg/dL). |
References
Widmark EMP. Principles and Applications of Medicolegal Alcohol Determination. Biomedical Publications. 1981. (Original derivation). Goldfrank's Toxicologic Emergencies. (Standard toxicology reference for Vd and SG values).
Examples
# Example 1: Methanol Ingestion
# 100 mL of 100% Methanol, 70kg person
estimate_toxic_alcohol_level("methanol", 100, "mL", 100, 70)
# Example 2: Ethanol Intoxication
# 500 mL of 40% Vodka, 80kg Male
# SG ~0.79, Vd ~0.7
estimate_toxic_alcohol_level("ethanol", 500, "mL", 40, 80, "male")
Urinary Protein Excretion Estimation (UPCR)
Description
Estimates the 24-hour urinary protein excretion using a random spot urine sample. The calculation uses the Urine Protein to Creatinine Ratio (UPCR), which correlates well with 24-hour protein measurement.
Usage
estimate_urinary_protein_excretion(urine_protein, urine_creatinine,
urine_protein_units = "mg/dL",
urine_creatinine_units = "mg/dL")
Arguments
urine_protein |
Numeric. Urine protein concentration. |
urine_creatinine |
Numeric. Urine creatinine concentration. |
urine_protein_units |
String. Units for urine protein. Options: "mg/dL" (default) or "g/L". |
urine_creatinine_units |
String. Units for urine creatinine. Options: "mg/dL" (default), "mmol/L", or "micromol/L". |
Details
The formula is based on the ratio:
UPCR = \frac{Urine Protein (mg/dL)}{Urine Creatinine (mg/dL)}
The resulting ratio represents the estimated grams of protein excreted per day (g/day).
Value
A list containing:
Estimated_Protein_Excretion_g_day |
The estimated 24-hour protein excretion in grams. |
UPCR_Ratio |
The calculated protein/creatinine ratio. |
References
Ginsberg JM, Chang BS, Matarese RA, Garella S. Use of single voided urine samples to estimate quantitative proteinuria. N Engl J Med. 1983;309(25):1543-1546. doi:10.1056/NEJM198312223092503
Examples
# Example 1: Nephrotic Range Proteinuria
# Protein 300 mg/dL, Creatinine 100 mg/dL
# Ratio = 3.0 g/day
estimate_urinary_protein_excretion(300, 100)
# Example 2: Using SI Units
# Protein 0.5 g/L -> 50 mg/dL
# Creatinine 10 mmol/L -> 113.1 mg/dL
# Ratio = 50 / 113.1 = 0.44 g/day
estimate_urinary_protein_excretion(0.5, 10, "g/L", "mmol/L")
Estimated/Expected Peak Expiratory Flow (Peak Flow) - NHANES III
Description
Calculates the estimated Peak Expiratory Flow (PEF) rate based on the Hankinson et al. (1999) equations derived from the Third National Health and Nutrition Examination Survey (NHANES III). These equations stratify by age, sex, and race/ethnicity (Caucasian, African-American, Mexican-American) and use height and age polynomial regression models.
Usage
estimated_peak_flow(age, height_in, sex, race, actual_pef = NULL)
Arguments
age |
Numeric. Patient age in years (Valid range: 8-80). |
height_in |
Numeric. Patient height in inches. |
sex |
String. Patient sex ("Male" or "Female"). |
race |
String. Patient race/ethnicity ("White", "Black", "Hispanic", or "Other"). "Other" uses the Caucasian/White equation coefficients. |
actual_pef |
Numeric (Optional). The patient's actual measured PEF in L/min. If provided, the function calculates the percent of predicted value. |
Value
A list containing:
Estimated_PEF_L_min |
The predicted Peak Expiratory Flow rate in Liters per minute. |
Percent_Predicted |
The ratio of the actual measured PEF to the estimated PEF (if actual_pef is provided). |
Method |
Citation of the formula source (Hankinson 1999). |
References
Hankinson JL, Odencrantz JR, Fedan KB. Spirometric reference values from a sample of the general U.S. population. Am J Respir Crit Care Med. 1999;159(1):179-187. doi:10.1164/ajrccm.159.1.9712108
Examples
# Example 1: Adult Male
# 45 years old, 70 inches (178 cm), White
# Estimated PEF: ~580-600 L/min depending on exact coeff
estimated_peak_flow(45, 70, "male", "white")
# Example 2: Child with Actual Reading
# 10 years old, 55 inches (140 cm), Black, Measured PEF 300
# Returns Estimated and % Predicted
estimated_peak_flow(10, 55, "male", "black", actual_pef = 300)
Embolic Stroke of Undetermined Source (ESUS) Criteria
Description
Evaluates whether a patient meets the criteria for Embolic Stroke of Undetermined Source (ESUS). This classification requires the visualization of a non-lacunar ischemic stroke and the exclusion of other specific causes such as atherosclerosis, cardioembolism, and other uncommon etiologies.
Usage
esus_criteria(ischemic_stroke_ct_mri, extracranial_stenosis_lt_50,
afib_flutter_absent, cardiac_embolism_source_absent,
other_causes_absent)
Arguments
ischemic_stroke_ct_mri |
Numeric (0 or 1). Ischemic stroke visualized on CT or MRI that is not lacunar? (1 = Yes). |
extracranial_stenosis_lt_50 |
Numeric (0 or 1). Absence of extracranial or intracranial atherosclerosis causing >= 50% luminal stenosis in arteries supplying the ischemic area? (1 = Yes/Absent). |
afib_flutter_absent |
Numeric (0 or 1). No major-risk cardioembolic source of embolism? (Specifically AFib/Flutter). Requires >= 24 hours of cardiac monitoring. (1 = Yes/Absent). |
cardiac_embolism_source_absent |
Numeric (0 or 1). No other major-risk cardioembolic source? (e.g., intracardiac thrombus, prosthetic valve, atrial myxoma, recent MI <4 weeks, LVEF <30%, etc.). (1 = Yes/Absent). |
other_causes_absent |
Numeric (0 or 1). No other specific cause of stroke identified (e.g., arteritis, dissection, migraine, drug misuse)? (1 = Yes/Absent). |
Value
A list containing:
Diagnosis |
"Criteria Met" or "Criteria Not Met". |
Missing_Criteria |
List of exclusion criteria that failed, if any. |
References
Hart RG, Diener HC, Coutts SB, et al. Embolic strokes of undetermined source: the case for a new clinical construct. Lancet Neurol. 2014;13(4):429-438. doi:10.1016/S1474-4422(13)70310-7
Examples
# Example 1: Diagnosis Confirmed
# Non-lacunar stroke, no stenosis, no AFib, no cardiac source, no other cause
esus_criteria(1, 1, 1, 1, 1)
# Example 2: Diagnosis Not Met (AFib present)
# Non-lacunar stroke, no stenosis, but AFib detected (input 0 for 'absent')
esus_criteria(1, 1, 0, 1, 1)
Endotracheal Tube (ETT) Depth and Tidal Volume Calculator
Description
Calculates the appropriate depth for endotracheal tube placement and target tidal volumes based on patient height and sex. It provides depth estimates using two methods: the Chula formula (Height/10 + 4) and the 3x Tube Size rule. It also calculates Predicted Body Weight (PBW) to determine lung-protective tidal volume ranges (6-8 mL/kg).
Usage
ett_depth_tidal_volume(height_cm, sex, tube_size_mm)
Arguments
height_cm |
Numeric. Patient height in centimeters. |
sex |
String. Patient sex ("Male" or "Female"). Used for PBW calculation. |
tube_size_mm |
Numeric. Internal diameter of the endotracheal tube in millimeters (e.g., 7.5). |
Value
A list containing:
Predicted_Body_Weight_kg |
Calculated PBW used for tidal volume dosing. |
Tidal_Volume_Target_6_8_ml_kg |
Recommended tidal volume range (6-8 mL/kg PBW) for lung-protective ventilation. |
ETT_Depth_Chula_cm |
Estimated depth of insertion from the Chula formula. |
ETT_Depth_3x_Size_cm |
Estimated depth of insertion using the 3x tube size rule. |
References
Techanivate A, Kumwilaisak K, Samranrean S. Estimation of the proper length of orotracheal intubation by Chula formula. J Med Assoc Thai. 2005;88(12):1838-1846. Acute Respiratory Distress Syndrome Network. Ventilation with lower tidal volumes as compared with traditional tidal volumes for acute lung injury and the acute respiratory distress syndrome. N Engl J Med. 2000;342(18):1301-1308. doi:10.1056/NEJM200005043421801
Examples
# Example 1: Adult Male
# 180 cm, Male, 7.5 mm tube
# PBW = 50 + 0.91*(180-152.4) = ~75 kg
# TV = 450-600 mL
# Depth (Chula) = 18 + 4 = 22 cm
# Depth (3x) = 22.5 cm
ett_depth_tidal_volume(180, "male", 7.5)
# Example 2: Adult Female
# 160 cm, Female, 7.0 mm tube
# PBW = 45.5 + 0.91*(160-152.4) = ~52 kg
# TV = 312-416 mL
# Depth (Chula) = 16 + 4 = 20 cm
# Depth (3x) = 21 cm
ett_depth_tidal_volume(160, "female", 7.0)
2012 EULAR/ACR Classification Criteria for Polymyalgia Rheumatica
Description
Calculates the classification score for Polymyalgia Rheumatica (PMR) based on the 2012 EULAR/ACR provisional criteria. The algorithm applies to patients >= 50 years old presenting with new bilateral shoulder pain and elevated CRP/ESR.
The function supports both the Clinical Criteria (Score >= 4 classifies as PMR) and the Clinical + Ultrasound Criteria (Score >= 5 classifies as PMR).
Usage
eular_acr_pmr_calc(age, stiffness_gt_45, hip_pain_limited_rom,
neg_serology, no_peripheral_pain, use_ultrasound = FALSE,
us_abn_shoulder_and_hip = 0, us_abn_both_shoulders = 0)
Arguments
age |
Numeric or String. Patient age in years. Must be >= 50 to proceed. |
stiffness_gt_45 |
Numeric or String (0 or 1). Morning stiffness duration > 45 minutes. 1 = Yes, 0 = No. (+2 points). |
hip_pain_limited_rom |
Numeric or String (0 or 1). Hip pain or limited range of motion. 1 = Yes, 0 = No. (+1 point). |
neg_serology |
Numeric or String (0 or 1). Negative RF and ACPA. 1 = Yes, 0 = No. (+2 points). |
no_peripheral_pain |
Numeric or String (0 or 1). Absence of other joint pain. 1 = Yes, 0 = No. (+1 point). |
use_ultrasound |
Logical. Set to TRUE to include ultrasound criteria in the scoring algorithm. Defaults to FALSE. |
us_abn_shoulder_and_hip |
Numeric or String (0 or 1). At least 1 shoulder with subdeltoid bursitis/biceps tenosynovitis/glenohumeral synovitis AND at least 1 hip with synovitis/trochanteric bursitis. (+1 point). |
us_abn_both_shoulders |
Numeric or String (0 or 1). Both shoulders with subdeltoid bursitis, biceps tenosynovitis, or glenohumeral synovitis. (+1 point). |
Value
A list containing the total score, the classification threshold used, and the final result ("Classified as PMR" or "Not Classified as PMR").
References
Dasgupta B, Cimmino MA, Maradit-Kremers H, et al. 2012 provisional classification criteria for polymyalgia rheumatica: a European League Against Rheumatism/American College of Rheumatology collaborative initiative. Ann Rheum Dis. 2012;71(4):484-492. doi:10.1136/annrheumdis-2011-200329
Examples
# Clinical criteria only: Patient with stiffness and negative serology
eular_acr_pmr_calc(age = 65, stiffness_gt_45 = 1, hip_pain_limited_rom = 0,
neg_serology = 1, no_peripheral_pain = 0)
# Clinical + Ultrasound criteria
eular_acr_pmr_calc(age = 70, stiffness_gt_45 = 1, hip_pain_limited_rom = 1,
neg_serology = 0, no_peripheral_pain = 0,
use_ultrasound = TRUE, us_abn_both_shoulders = 1)
EUROMACS Right Heart Failure (RHF) Risk Score
Description
Calculates the EUROMACS RHF Score to predict the risk of early right heart failure following Left Ventricular Assist Device (LVAD) implantation. This scoring system was derived from the European Registry for Patients with Mechanical Circulatory Support (EUROMACS).
Usage
euromacs_rhf_score(cvp_pcwp_ratio_gt_054, multiple_inotropes,
severe_rv_dysfunction, intermacs_1_2, hemoglobin_le_10)
Arguments
cvp_pcwp_ratio_gt_054 |
Numeric (0 or 1). Is the ratio of Right Atrial Pressure (CVP) to Pulmonary Capillary Wedge Pressure (PCWP) > 0.54? (1 = Yes, +2 points). |
multiple_inotropes |
Numeric (0 or 1). Requirement for >= 2 inotropes? (1 = Yes, +2.5 points). |
severe_rv_dysfunction |
Numeric (0 or 1). Presence of severe Right Ventricular (RV) dysfunction on echocardiography (TAPSE < 14mm or subjective assessment). (1 = Yes, +2 points). |
intermacs_1_2 |
Numeric (0 or 1). INTERMACS Profile 1 ("Crash and Burn") or 2 ("Sliding on Inotropes"). (1 = Yes, +2 points). |
hemoglobin_le_10 |
Numeric (0 or 1). Hemoglobin <= 10 g/dL (<= 100 g/L). (1 = Yes, +1 point). |
Value
A list containing:
EUROMACS_Score |
The calculated risk score (Range 0-9.5). |
Risk_Category |
Classification (Low 0-2, Intermediate 2.5-4, High >4). |
Early_RHF_Risk |
Estimated percentage risk of early RHF. |
References
Soliman OI, Akin S, Muslem R, et al. Derivation and validation of a novel right heart failure prediction score for patients undergoing left ventricular assist device implantation: the EUROMACS (European Registry for Patients with Mechanical Circulatory Support) Right Heart Failure Risk Score. Eur J Cardiothorac Surg. 2018;53(4):847-855. doi:10.1093/ejcts/ezx320
Examples
# Example 1: High Risk
# Ratio > 0.54 (+2), Severe RVD (+2), Multiple Inotropes (+2.5)
# Score = 6.5
euromacs_rhf_score(1, 1, 1, 0, 0)
# Example 2: Low Risk
# Hemoglobin 9.5 (+1), no other factors
# Score = 1
euromacs_rhf_score(0, 0, 0, 0, 1)
European System for Cardiac Operative Risk Evaluation (EuroSCORE) II
Description
Calculates the EuroSCORE II, which predicts in-hospital mortality after major cardiac surgery. This model improves upon the original EuroSCORE by incorporating a contemporary patient population and using a full logistic regression model, allowing for a more accurate and nuanced risk prediction.
Usage
euroscore_ii(age, gender, renal_impairment, extracardiac_arteriopathy, poor_mobility,
previous_cardiac_surgery, chronic_lung_disease, active_endocarditis,
critical_preoperative_state, diabetes_on_insulin, nyha_class,
ccs_class_4_angina, lv_function, recent_mi, pulmonary_hypertension,
urgency, weight_of_intervention, surgery_on_thoracic_aorta)
Arguments
age |
Numeric. Patient age in years. |
gender |
Character. "male" or "female". |
renal_impairment |
Character. Degree of renal impairment, categorized by Creatinine Clearance (CrCl) or Dialysis status. Options: "normal" (CrCl > 85 mL/min), "creatinine_clearance_50_85" (50-85 mL/min), "creatinine_clearance_lt_50" (< 50 mL/min), or "dialysis". |
extracardiac_arteriopathy |
Numeric (0 or 1). Includes claudication, carotid occlusion >50%, or previous/planned intervention on peripheral arteries or aorta. |
poor_mobility |
Numeric (0 or 1). Severe impairment of mobility due to musculoskeletal or neurological dysfunction. |
previous_cardiac_surgery |
Numeric (0 or 1). History of previous major cardiac operation involving opening of the pericardium. |
chronic_lung_disease |
Numeric (0 or 1). Long-term use of bronchodilators or steroids for lung disease. |
active_endocarditis |
Numeric (0 or 1). Patient is still on antibiotic treatment for endocarditis at the time of surgery. |
critical_preoperative_state |
Numeric (0 or 1). Presence of critical signs (e.g., VT/VF, cardiac massage, pre-op ventilation, inotropes, IABP/VAD before OR, acute renal failure/anuria). |
diabetes_on_insulin |
Numeric (0 or 1). Diabetes mellitus treated with insulin. |
nyha_class |
Numeric (1, 2, 3, or 4). New York Heart Association functional class. |
ccs_class_4_angina |
Numeric (0 or 1). Angina at rest (Canadian Cardiovascular Society Class 4 Angina). |
lv_function |
Character. Left Ventricular Ejection Fraction (LVEF). Options: "good" (> 50%), "moderate" (31-50%), "poor" (21-30%), or "very_poor" (<= 20%). |
recent_mi |
Numeric (0 or 1). Myocardial infarction within the last 90 days. |
pulmonary_hypertension |
Character. Systolic Pulmonary Artery Pressure (PAP). Options: "none" (< 31 mmHg), "moderate" (31-55 mmHg), or "severe" (> 55 mmHg). |
urgency |
Character. Urgency of the procedure. Options: "elective", "urgent", "emergency", or "salvage" (most critical). |
weight_of_intervention |
Character. The type of procedure. Options: "isolated_cabg", "single_non_cabg", "two_procedures" (e.g., CABG + valve), or "three_procedures". |
surgery_on_thoracic_aorta |
Numeric (0 or 1). Surgery on the thoracic aorta (including root and arch). |
Details
The EuroSCORE II is calculated using a logistic regression model:
Predicted Mortality = \frac{e^L}{1 + e^L}
Where L is the linear predictor (\beta_0 + \sum \beta_i X_i) derived from the 18 patient-related risk factors and surgical factors.
Value
A list containing the predicted in-hospital mortality risk as a percentage.
References
Nashef SAM, Roques F, Sharples PE, et al. EuroSCORE II. Eur J Cardiothorac Surg. 2012;41(4):734-744. doi:10.1093/ejcts/ezs043
Examples
euroscore_ii(
age = 65,
gender = "male",
renal_impairment = "normal",
extracardiac_arteriopathy = 0,
poor_mobility = 0,
previous_cardiac_surgery = 0,
chronic_lung_disease = 0,
active_endocarditis = 0,
critical_preoperative_state = 0,
diabetes_on_insulin = 0,
nyha_class = 1,
ccs_class_4_angina = 0,
lv_function = "good",
recent_mi = 0,
pulmonary_hypertension = "none",
urgency = "elective",
weight_of_intervention = "isolated_cabg",
surgery_on_thoracic_aorta = 0
)
EUTOS Score for Chronic Myelogenous Leukemia (CML)
Description
Calculates the EUTOS (European Treatment and Outcome Study) score to predict the likelihood of achieving Complete Cytogenetic Response (CCyR) at 18 months in newly diagnosed CML patients treated with Tyrosine Kinase Inhibitors (TKIs). The score uses the percentage of basophils in peripheral blood and spleen size measured below the costal margin.
Usage
eutos_cml_score(basophils_percent, spleen_size_cm)
Arguments
basophils_percent |
Numeric. Percentage of basophils in peripheral blood. |
spleen_size_cm |
Numeric. Spleen size measured as the maximum distance palpable below the costal margin in centimeters. |
Value
A list containing:
EUTOS_Score |
The calculated prognostic score. |
Risk_Category |
"Low Risk" (Score <= 87) or "High Risk" (Score > 87). |
References
Hasford J, Baccarani M, Hoffmann V, et al. Predicting complete cytogenetic response and subsequent progression-free survival in 2060 patients with CML on imatinib treatment: the EUTOS score. Blood. 2011;118(3):686-692. doi:10.1182/blood-2010-12-325548
Examples
# Example 1: Low Risk
# Basophils 2%, Spleen 0 cm
# Score = (7*2) + (4*0) = 14
eutos_cml_score(2, 0)
# Example 2: High Risk
# Basophils 8%, Spleen 10 cm
# Score = (7*8) + (4*10) = 56 + 40 = 96
eutos_cml_score(8, 10)
EVendo Score for Esophageal Varices Screening
Description
Structures the clinical inputs for the EVendo score, a predictive tool for identifying esophageal varices in patients with cirrhosis. The score utilizes Platelet count, INR, and Serum Urea to risk-stratify patients and determine the necessity of screening endoscopy.
Usage
evendo_esophageal_varices_score(platelet_count, inr, urea, urea_units = "mg/dL")
Arguments
platelet_count |
Numeric. Platelet count in 10^9/L (or x1000/uL). |
inr |
Numeric. International Normalized Ratio. |
urea |
Numeric. Serum Urea level. |
urea_units |
String. Units for the urea input. Options: "mg/dL" (Urea), "BUN_mg_dL" (BUN to be converted), "mmol/L" (Urea SI units). |
Value
A list containing:
Risk_Factors_Present |
Count of abnormal parameters (Low Platelets, High INR, High Urea). |
Interpretation |
General clinical guidance based on the presence of risk factors. |
Inputs |
Standardized input values. |
References
Tellez-Avila F, Chávez-Tapia N, Franco-Guzmán AM, et al. EVendo score: A simple model for the prediction of esophageal varices in patients with cirrhosis. Turk J Gastroenterol. 2019;30(2):168-173. doi:10.5152/tjg.2018.18055
Examples
# Example 1: High Risk
# Plt 80, INR 1.8, Urea 50 mg/dL
evendo_esophageal_varices_score(80, 1.8, 50)
# Example 2: Low Risk
# Plt 200, INR 1.0, Urea 20 mg/dL
evendo_esophageal_varices_score(200, 1.0, 20)
FACE-DROPS Score for Stroke Risk
Description
Calculates the FACE-DROPS score to assess the likelihood of acute stroke versus stroke mimics. This tool evaluates facial weakness, arm weakness, speech impairment, eye deviation, duration/onset, prior history, and seizure activity (which often suggests a mimic).
Usage
face_drops_stroke_score(facial_droop, arm_drift, communication_speech,
eye_deviation, duration_sudden, recurrence_or_prior,
onset_seizure, seizure_history, age)
Arguments
facial_droop |
Numeric (0 or 1). Presence of facial droop or asymmetry. (1 = Yes). |
arm_drift |
Numeric (0 or 1). Presence of arm drift or weakness. (1 = Yes). |
communication_speech |
Numeric (0 or 1). Presence of speech disturbance or confusion. (1 = Yes). |
eye_deviation |
Numeric (0 or 1). Presence of gaze deviation. (1 = Yes). |
duration_sudden |
Numeric (0 or 1). Sudden onset of symptoms consistent with vascular event. (1 = Yes). |
recurrence_or_prior |
Numeric (0 or 1). History of prior stroke or vascular disease. (1 = Yes). |
onset_seizure |
Numeric (0 or 1). Seizure activity at onset. (1 = Yes). Note: This typically subtracts from the stroke likelihood. |
seizure_history |
Numeric (0 or 1). Known history of epilepsy or seizures. (1 = Yes). |
age |
Numeric. Patient age in years. |
Value
A list containing:
Score |
The calculated score. |
Interpretation |
Clinical interpretation guidance (Likely Stroke vs. Mimic). |
Examples
# Example 1: High Probability
# Face(1), Arm(1), Speech(1), Sudden(1), No Seizure(0), Age 70
face_drops_stroke_score(1, 1, 1, 0, 1, 1, 0, 0, 70)
# Example 2: Potential Mimic
# Seizure at onset(1), History of Seizures(1), Age 30
face_drops_stroke_score(0, 0, 0, 0, 1, 0, 1, 1, 30)
Field Assessment Stroke Triage for Emergency Destination (FAST-ED)
Description
Calculates the FAST-ED score to identify stroke patients in the prehospital setting who are likely to have a Large Vessel Occlusion (LVO) and may benefit from direct transport to a Comprehensive Stroke Center for thrombectomy. The score evaluates facial palsy, arm weakness, speech changes, eye deviation, and denial/neglect.
Usage
fast_ed_score(facial_palsy, arm_weakness, speech_changes, eye_deviation,
denial_neglect)
Arguments
facial_palsy |
Numeric (0 or 1). 0: Normal or minor paralysis. 1: Partial or complete paralysis. |
arm_weakness |
Numeric (0, 1, or 2). 0: No drift. 1: Drift, or some effort against gravity. 2: No effort against gravity, or no movement. |
speech_changes |
Numeric (0, 1, or 2). 0: Absent. 1: Mild to moderate impairment. 2: Severe, global aphasia, or mute. |
eye_deviation |
Numeric (0, 1, or 2). 0: Absent. 1: Partial deviation. 2: Forced deviation. |
denial_neglect |
Numeric (0, 1, or 2). Extinction/Inattention. 0: Absent. 1: Extinction to one modality. 2: Extinction to both modalities. |
Value
A list containing:
FAST_ED_Score |
The calculated total score (Range 0-9). |
Likelihood |
Risk assessment for LVO (Score >= 4 suggests High Likelihood). |
Recommendation |
Triage guidance for hospital destination. |
References
Lima FO, Silva GS, Furie KL, et al. Field Assessment Stroke Triage for Emergency Destination: A Simple and Accurate Prehospital Scale to Detect Large Vessel Occlusion Strokes. Stroke. 2016;47(8):1997-2002. doi:10.1161/STROKEAHA.116.013301
Examples
# Example 1: High Probability of LVO
# Partial Face(1), No Arm Effort(2), Severe Speech(2), Forced Eyes(2), No Neglect(0)
# Score = 7
fast_ed_score(1, 2, 2, 2, 0)
# Example 2: Low Probability
# Minor Face(0), Arm Drift(1), Mild Speech(1), No Eyes(0), No Neglect(0)
# Score = 2
fast_ed_score(0, 1, 1, 0, 0)
Focused Assessment with Sonography for Trauma (FAST) Algorithm
Description
Interprets the findings of the FAST exam in the context of the trauma patient's hemodynamic status. The FAST exam uses ultrasound to detect free fluid in the pericardial, perihepatic (RUQ), perisplenic (LUQ), and pelvic regions. The result guides immediate surgical or diagnostic decisions (Laparotomy vs. CT vs. Observation).
Usage
fast_trauma_algorithm(pericardial_fluid, ruq_fluid, luq_fluid, pelvic_fluid,
patient_unstable)
Arguments
pericardial_fluid |
Numeric (0 or 1). Presence of fluid in the subxiphoid/pericardial view. (1 = Yes). |
ruq_fluid |
Numeric (0 or 1). Presence of fluid in the Right Upper Quadrant (Morison's Pouch). (1 = Yes). |
luq_fluid |
Numeric (0 or 1). Presence of fluid in the Left Upper Quadrant (Splenorenal Recess). (1 = Yes). |
pelvic_fluid |
Numeric (0 or 1). Presence of fluid in the Pelvic view (Retrovesical/Pouch of Douglas). (1 = Yes). |
patient_unstable |
Numeric (0 or 1). Is the patient hemodynamically unstable (e.g., Hypotension, Shock)? (1 = Yes). |
Value
A list containing:
Result |
The overall interpretation of the FAST exam (Positive/Negative and location). |
Management_Recommendation |
Clinical guidance based on ATLS protocols for the combination of FAST result and stability. |
References
Rozycki GS, Ochsner MG, Schmidt JA, et al. A prospective study of surgeon-performed ultrasound as the primary adjuvant modality for injured patient assessment. J Trauma. 1995;39(3):492-498.
Examples
# Example 1: Unstable patient with fluid in RUQ
# Result: Positive FAST -> Laparotomy
fast_trauma_algorithm(0, 1, 0, 0, 1)
# Example 2: Stable patient with fluid in Pelvis
# Result: Positive FAST -> CT Scan
fast_trauma_algorithm(0, 0, 0, 1, 0)
# Example 3: Unstable patient with Negative FAST
# Result: Negative -> Search for other causes (Pelvic fx, etc.)
fast_trauma_algorithm(0, 0, 0, 0, 1)
Fat-Free Mass (Janmahasatian Equation)
Description
Calculates the Fat-Free Mass (FFM) of a patient using the Janmahasatian equation. This metric is often used for pharmacokinetic dosing of drugs with narrow therapeutic indices (e.g., digoxin, aminoglycosides) in obese patients, as it provides a more accurate estimate of metabolically active tissue than total body weight or ideal body weight.
Usage
fat_free_mass(weight_kg, height_cm, sex)
Arguments
weight_kg |
Numeric. Patient actual body weight in kilograms. |
height_cm |
Numeric. Patient height in centimeters. |
sex |
String. Patient sex ("Male" or "Female"). |
Value
A list containing:
Fat_Free_Mass_kg |
The calculated Fat-Free Mass in kg. |
BMI |
The calculated Body Mass Index used in the equation. |
References
Janmahasatian S, Duffull SB, Ash S, Ward LC, Byrne NM, Green B. Quantification of lean bodyweight. Clin Pharmacokinet. 2005;44(10):1051-1065. doi:10.2165/00003088-200544100-00004
Examples
# Example 1: Male
# 80kg, 180cm
fat_free_mass(80, 180, "male")
# Example 2: Female
# 70kg, 165cm
fat_free_mass(70, 165, "female")
Fetal Biophysical Profile (BPP) Score
Description
Calculates the Fetal Biophysical Profile score to assess fetal well-being and identify risk of fetal hypoxia or acidosis. The profile evaluates five parameters: Non-Stress Test (NST), Amniotic Fluid Volume, Fetal Breathing Movements, Fetal Tone, and Fetal Body Movements. Each parameter is scored as 2 (Normal) or 0 (Abnormal).
Usage
fetal_biophysical_profile(nst_reactive, amniotic_fluid_volume,
fetal_breathing_movements, fetal_tone,
fetal_body_movements)
Arguments
nst_reactive |
Numeric (0 or 2). Non-Stress Test result. 2: Reactive (>=2 accelerations of >=15 bpm for >=15 sec in 20 mins). 0: Non-reactive (<2 accelerations in 40 mins). |
amniotic_fluid_volume |
Numeric (0 or 2). Amniotic Fluid Volume. 2: Single deepest vertical pocket > 2 cm. 0: Largest pocket <= 2 cm (Oligohydramnios). |
fetal_breathing_movements |
Numeric (0 or 2). Fetal Breathing. 2: >= 1 episode of rhythmic breathing lasting >= 30 sec within 30 mins. 0: < 30 sec of breathing in 30 mins. |
fetal_tone |
Numeric (0 or 2). Fetal Tone. 2: >= 1 episode of extension of a fetal extremity with return to flexion (or opening/closing of hand). 0: Slow extension with partial return or no movement. |
fetal_body_movements |
Numeric (0 or 2). Fetal Movements. 2: >= 3 discrete body/limb movements within 30 mins. 0: < 3 movements. |
Value
A list containing:
BPP_Total_Score |
The sum of the 5 component scores (Range 0-10). |
Risk_Assessment |
Interpretation of fetal well-being (Normal, Equivocal, or Asphyxia). |
Management_Guidance |
Clinical recommendations based on the score and amniotic fluid status. |
References
Manning FA, Platt LD, Sipos L. Antepartum fetal evaluation: development of a fetal biophysical profile. Am J Obstet Gynecol. 1980;136(6):787-795. doi:10.1016/0002-9378(80)90457-3
Examples
# Example 1: Normal
# All parameters normal
fetal_biophysical_profile(2, 2, 2, 2, 2)
# Example 2: Equivocal (Score 6)
# Non-reactive NST, No breathing, others normal
fetal_biophysical_profile(0, 2, 0, 2, 2)
# Example 3: Oligohydramnios (Score 8 but AFV=0)
# All normal except fluid
fetal_biophysical_profile(2, 0, 2, 2, 2)
FeverPAIN Score for Strep Pharyngitis
Description
Calculates the FeverPAIN score to estimate the probability of streptococcal pharyngitis and guide antibiotic prescribing. It evaluates five clinical criteria: Fever, Purulence, Attend rapidly (<= 3 days), Inflamed tonsils, and No cough/coryza.
Usage
feverpain_score(fever_24hr, purulence, attend_rapidly_3days,
inflamed_tonsils, no_cough)
Arguments
fever_24hr |
Numeric (0 or 1). Fever in the last 24 hours. (1 = Yes, +1 point). |
purulence |
Numeric (0 or 1). Purulence (pus) on tonsils. (1 = Yes, +1 point). |
attend_rapidly_3days |
Numeric (0 or 1). Patient attended within 3 days or less of symptom onset. (1 = Yes, +1 point). |
inflamed_tonsils |
Numeric (0 or 1). Severely inflamed tonsils. (1 = Yes, +1 point). |
no_cough |
Numeric (0 or 1). Absence of cough or coryza. (1 = Yes, +1 point). |
Value
A list containing:
FeverPAIN_Score |
The calculated score (Range 0-5). |
Strep_Probability |
Estimated percentage risk of streptococcal infection. |
Recommendation |
Clinical guidance regarding antibiotic use (None, Delayed, or Immediate). |
References
Little P, Moore M, Hobbs FD, et al. PRImary care Streptococcal Management (PRISM) study: identifying clinical variables associated with Lancefield group A beta-haemolytic streptococci and Lancefield group C/G streptococci from patients presenting with acute sore throat. BMJ Open. 2013;3(10):e003943. doi:10.1136/bmjopen-2013-003943
Examples
# Example 1: High Risk
# Fever (+1), Pus (+1), Rapid onset (+1), Inflamed (+1), No Cough (+1)
# Score = 5
feverpain_score(1, 1, 1, 1, 1)
# Example 2: Moderate Risk
# No Fever (0), Pus (0), Rapid onset (+1), Inflamed (+1), No Cough (+1)
# Score = 3
feverpain_score(0, 0, 1, 1, 1)
Calculate Fibrosis-4 (FIB-4) Index for Liver Fibrosis
Description
Calculate the extent of liver fibrosis/scarring in HCV/HBV patients without biopsy or ultrasound, as deduced by Sterling et al. 2006. Patient validation has not been included in patients <35 or above 65. As validated by Kim et al. 2010 and McPherson et al. 2017, a FIB-4 score of <1.45 is a fibrosis stage of 0-1, FIB-4 1.45-3.25 is a stage of 2-3, and FIB-4 of >3.25 is a tage of 4-6.
Usage
fib4(age, ast, alt, plt)
Arguments
age |
Numeric value of age in years. |
ast |
Numeric value of aspartate aminotransferase in U/L. |
alt |
Numeric value of alanine aminotransferase in U/L. |
plt |
Numeric value of platelets in 10^3/uL or 10^9/L. |
Value
A numeric value/vector with predicted level of FIB-4 index liver fibrosis.
References
Sterling, R.K., Lissen, E., Clumeck, N., Sola, R., Correa, M.C., Montaner, J., S. Sulkowski, M., Torriani, F.J., Dieterich, D.T., Thomas, D.L., Messinger, D. and Nelson, M. (2006), Development of a simple noninvasive index to predict significant fibrosis in patients with HIV/HCV coinfection. Hepatology, 43: 1317-1325. https://doi.org/10.1002/hep.21178 Kim BK, Kim DY, Park JY, et al. Validation of FIB-4 and comparison with other simple noninvasive indices for predicting liver fibrosis and cirrhosis in hepatitis B virus-infected patients. Liver Int. 2010;30(4):546-553. doi:10.1111/j.1478-3231.2009.02192.x Mcpherson S, Hardy T, Dufour JF, et al. Age as a Confounding Factor for the Accurate Non-Invasive Diagnosis of Advanced NAFLD Fibrosis. Am J Gastroenterol. 2017;112(5):740-751.
Examples
# The function is defined as
fib4(40,15,7,175)
Fibrotic NASH Index (FNI)
Description
Calculates the Fibrotic NASH Index (FNI) to predict the presence of advanced fibrosis in patients with Nonalcoholic Steatohepatitis (NASH). This simple index uses three common laboratory values: AST, HDL cholesterol, and HbA1c.
Usage
fibrotic_nash_index(ast, hdl_cholesterol, hba1c)
Arguments
ast |
Numeric. Aspartate Aminotransferase level (U/L). |
hdl_cholesterol |
Numeric. High-Density Lipoprotein Cholesterol level (mg/dL). |
hba1c |
Numeric. Hemoglobin A1c percentage. |
Value
A list containing:
FNI_Score |
The calculated risk score (probability between 0 and 1). |
Risk_Category |
Classification (Low < 0.10, Intermediate 0.10-0.33, High > 0.33). |
Interpretation |
Clinical meaning of the risk category. |
References
Loomba R, et al. Fibrotic NASH Index: A Simple Model to Predict Advanced Fibrosis in Patients With Nonalcoholic Steatohepatitis. Hepatology. 2019.
Examples
# Example 1: High Risk
# AST 80, HDL 30, HbA1c 8.5
fibrotic_nash_index(80, 30, 8.5)
# Example 2: Low Risk
# AST 20, HDL 60, HbA1c 5.0
fibrotic_nash_index(20, 60, 5.0)
Cardiac Output (Fick's Formula)
Description
Calculates Cardiac Output using the Fick principle, which states that the blood flow through an organ is equal to the uptake or release of a substance by that organ divided by the arteriovenous difference of that substance. In this context, oxygen is the substance used.
Usage
fick_cardiac_output(hemoglobin_g_dl, sa_o2_percent, sv_o2_percent,
vo2_ml_min, pa_o2_mmhg = NULL, pv_o2_mmhg = NULL)
Arguments
hemoglobin_g_dl |
Numeric. Hemoglobin concentration in g/dL. |
sa_o2_percent |
Numeric. Arterial Oxygen Saturation percentage (e.g., 98). |
sv_o2_percent |
Numeric. Mixed Venous Oxygen Saturation percentage (e.g., 75). |
vo2_ml_min |
Numeric. Oxygen Consumption in mL/min. This can be a measured value or an estimated value (often 125 mL/min/m2 * BSA). |
pa_o2_mmhg |
Numeric (Optional). Arterial partial pressure of oxygen. Used to calculate dissolved oxygen content. |
pv_o2_mmhg |
Numeric (Optional). Venous partial pressure of oxygen. Used to calculate dissolved oxygen content. |
Value
A list containing:
Cardiac_Output_L_min |
The calculated cardiac output in Liters per minute. |
Arterial_O2_Content_mL_dL |
Calculated arterial oxygen content (CaO2). |
Venous_O2_Content_mL_dL |
Calculated venous oxygen content (CvO2). |
AV_O2_Difference_mL_dL |
The arteriovenous oxygen difference. |
References
Fick A. Uber die messung des blutquantums in den herzventrikeln. Sitzungsberichte der Physikalisch-Medizinischen Gesellschaft zu Wurzburg. 1870;2:16.
Examples
# Example 1: Standard Values
# Hgb 13 g/dL, SaO2 98%, SvO2 70%, VO2 250 mL/min
fick_cardiac_output(13, 98, 70, 250)
# Example 2: Including Dissolved Oxygen
# Hgb 10 g/dL, SaO2 100%, SvO2 60%, VO2 200 mL/min, PaO2 100, PvO2 35
fick_cardiac_output(10, 100, 60, 200, 100, 35)
FIGO Staging for Ovarian Cancer (2014)
Description
Determines the 2014 FIGO Stage for Ovarian, Fallopian Tube, and Peritoneal Cancer based on surgical and pathological findings.
Usage
figo_ovarian_cancer_staging(tumor_location, capsule_rupture, surface_involvement,
ascites_cytology, pelvic_extension, abdominal_extension,
lymph_node_involvement, distant_metastasis)
Arguments
tumor_location |
String. "one_ovary", "both_ovaries", "none". |
capsule_rupture |
Numeric (0 or 1). Capsule ruptured (surgical or spontaneous). |
surface_involvement |
Numeric (0 or 1). Tumor present on ovarian/fallopian tube surface. |
ascites_cytology |
Numeric (0 or 1). Malignant cells in ascites or peritoneal washings. |
pelvic_extension |
String. "none", "uterus_tubes", "other_pelvic_tissues". |
abdominal_extension |
String. "none", "microscopic" (extrapelvic), "macroscopic_lt_2cm", "macroscopic_gt_2cm". (Includes liver/spleen capsule involvement). |
lymph_node_involvement |
String. "none", "retroperitoneal_lt_10mm", "retroperitoneal_gt_10mm". |
distant_metastasis |
String. "none", "pleural_effusion" (positive cytology), "parenchymal" (liver/spleen parenchyma), "extra_abdominal" (other organs/inguinal nodes). |
Value
A list containing:
FIGO_Stage |
The calculated stage (I-IV with substages). |
Description |
The clinical definition of the stage. |
References
Prat J; FIGO Committee on Gynecologic Oncology. Staging classification for cancer of the ovary, fallopian tube, and peritoneum. Int J Gynaecol Obstet. 2014;124(1):1-5. doi:10.1016/j.ijgo.2013.10.001
Examples
# Example 1: Stage IA
figo_ovarian_cancer_staging("one_ovary", 0, 0, 0, "none", "none", "none", "none")
# Example 2: Stage IIIC (Macroscopic abdominal mets > 2cm)
figo_ovarian_cancer_staging("both_ovaries", 1, 1, 1, "uterus_tubes",
"macroscopic_gt_2cm", "retroperitoneal_gt_10mm", "none")
FINDRISC (Finnish Diabetes Risk Score)
Description
Calculates the FINDRISC score to estimate the 10-year risk of developing Type 2 Diabetes. This screening tool identifies individuals at high risk who may benefit from lifestyle interventions or further diagnostic testing.
Usage
findrisc_score(age, bmi, waist_cm, sex, physical_activity,
vegetables_fruit_daily, bp_meds, high_glucose_history,
family_history)
Arguments
age |
Numeric. Patient age in years. <45: 0 pts. 45-54: 2 pts. 55-64: 3 pts. >64: 4 pts. |
bmi |
Numeric. Body Mass Index (kg/m^2). <25: 0 pts. 25-30: 1 pt. >30: 3 pts. |
waist_cm |
Numeric. Waist circumference in centimeters. Male: <94 (0), 94-102 (3), >102 (4). Female: <80 (0), 80-88 (3), >88 (4). |
sex |
String. "male" or "female". Used to determine waist circumference thresholds. |
physical_activity |
Numeric (0 or 1). Do you usually have at least 30 minutes of physical activity at work and/or leisure time? (1 = Yes, 0 pts; 0 = No, 2 pts). |
vegetables_fruit_daily |
Numeric (0 or 1). How often do you eat vegetables, fruit, or berries? (1 = Every day, 0 pts; 0 = Not every day, 1 pt). |
bp_meds |
Numeric (0 or 1). Have you ever taken medication for high blood pressure? (1 = Yes, 2 pts; 0 = No, 0 pts). |
high_glucose_history |
Numeric (0 or 1). Have you ever been found to have high blood glucose (e.g., in a health exam, during illness, during pregnancy)? (1 = Yes, 5 pts; 0 = No, 0 pts). |
family_history |
String. Have any members of your immediate family or other relatives been diagnosed with diabetes? "none": No (0 pts). "2nd_degree": Yes, grandparent, aunt, uncle, or first cousin (3 pts). "1st_degree": Yes, parent, brother, sister, or own child (5 pts). |
Value
A list containing:
FINDRISC_Score |
The calculated total risk score (Range 0-26). |
Risk_Level |
Classification (Low, Slightly Elevated, Moderate, High, Very High). |
Ten_Year_Diabetes_Risk |
Estimated percentage probability of developing Type 2 Diabetes within 10 years. |
References
Lindström J, Tuomilehto J. The diabetes risk score: a practical tool to predict type 2 diabetes risk. Diabetes Care. 2003;26(3):725-731. doi:10.2337/diacare.26.3.725
Examples
# Example 1: High Risk
# 60yo (+3), BMI 32 (+3), Waist 110 (Male, +4), No Activity (+2), 1st Degree Fam (+5)
# Score = 17
findrisc_score(60, 32, 110, "male", 0, 1, 0, 0, "1st_degree")
# Example 2: Low Risk
# 35yo (0), BMI 22 (0), Waist 70 (Female, 0), Active (0), Daily Veg (0), No Hx
# Score = 0
findrisc_score(35, 22, 70, "female", 1, 1, 0, 0, "none")
Fisher Grading Scale for Subarachnoid Hemorrhage (SAH)
Description
Calculates the Fisher Grade for patients with subarachnoid hemorrhage based on initial CT scan findings. The scale predicts the risk of cerebral vasospasm. Note that Grade 3 (Thick clot) carries the highest risk, higher than Grade 4 (ICH/IVH).
Usage
fisher_sah_grade(sah_present, ich_ivh_present, clot_thickness_ge_1mm)
Arguments
sah_present |
Numeric (0 or 1). Is subarachnoid blood detected on CT? (1 = Yes). |
ich_ivh_present |
Numeric (0 or 1). Is there an intracerebral (ICH) or intraventricular (IVH) clot? (1 = Yes). Note: In the original Fisher scale, this finding (Grade 4) defines the category regardless of SAH thickness, though clinically Grade 3 implies higher vasospasm risk. |
clot_thickness_ge_1mm |
Numeric (0 or 1). Are localized clots or vertical layers >= 1mm thick present? (1 = Yes). |
Value
A list containing:
Fisher_Grade |
The calculated grade (1-4). |
CT_Findings |
The description of the grade. |
Vasospasm_Risk |
Estimated percentage risk of developing vasospasm. |
References
Fisher CM, Kistler JP, Davis JM. Relation of cerebral vasospasm to subarachnoid hemorrhage visualized by computerized tomographic scanning. Neurosurgery. 1980;6(1):1-9. doi:10.1227/00006123-198001000-00001
Examples
# Example 1: Highest Risk (Grade 3)
# SAH present, No ICH/IVH, Thick clot
fisher_sah_grade(1, 0, 1)
# Example 2: Grade 4
# SAH present, ICH present (overrides thickness in classification logic)
fisher_sah_grade(1, 1, 0)
FLACC Behavioral Pain Assessment Scale
Description
Calculates the FLACC score, a behavioral pain assessment scale used for children between the ages of 2 months and 7 years or individuals unable to communicate their pain. It evaluates five categories: Face, Legs, Activity, Cry, and Consolability. Each category is scored from 0 to 2, resulting in a total score between 0 and 10.
Usage
flacc_pain_score(face, legs, activity, cry, consolability)
Arguments
face |
Numeric (0-2). 0: No particular expression or smile. 1: Occasional grimace or frown, withdrawn, disinterested. 2: Frequent to constant quivering chin, clenched jaw. |
legs |
Numeric (0-2). 0: Normal position or relaxed. 1: Uneasy, restless, tense. 2: Kicking, or legs drawn up. |
activity |
Numeric (0-2). 0: Lying quietly, normal position, moves easily. 1: Squirming, shifting back and forth, tense. 2: Arched, rigid, or jerking. |
cry |
Numeric (0-2). 0: No cry (awake or asleep). 1: Moans or whimpers; occasional complaint. 2: Crying steadily, screams or sobs, frequent complaints. |
consolability |
Numeric (0-2). 0: Content, relaxed. 1: Reassured by occasional touching, hugging, or being talked to; distractible. 2: Difficult to console or comfort. |
Value
A list containing:
FLACC_Score |
The calculated total score (Range 0-10). |
Interpretation |
Clinical interpretation of pain severity (Relaxed, Mild, Moderate, Severe). |
References
Merkel SI, Voepel-Lewis T, Shayevitz JR, Malviya S. The FLACC: a behavioral scale for scoring postoperative pain in young children. Pediatr Nurs. 1997;23(3):293-297.
Examples
# Example 1: Severe Pain
# Grimacing(2), Kicking(2), Arched(2), Screaming(2), Difficult to console(2)
flacc_pain_score(2, 2, 2, 2, 2)
# Example 2: Mild Discomfort
# Frown(1), Normal legs(0), Squirming(1), No cry(0), Distractible(1)
# Score = 3
flacc_pain_score(1, 0, 1, 0, 1)
Flamm VBAC Risk Score
Description
Calculates the Flamm Score to predict the probability of a successful Vaginal Birth After Cesarean (VBAC). The model incorporates maternal age, vaginal birth history, indication for the primary cesarean, and cervical status at admission.
Usage
flamm_vbac_score(age, vaginal_history, reason_for_prior_c_section,
cervical_effacement_percent, cervical_dilation_cm)
Arguments
age |
Numeric. Maternal age in years. (<40 adds 2 points). |
vaginal_history |
String. History of vaginal deliveries. "none": No vaginal deliveries (0 pts). "before": Vaginal delivery before C-section (1 pt). "after": Vaginal delivery after C-section (2 pts). "both": Vaginal deliveries before and after C-section (4 pts). |
reason_for_prior_c_section |
String. Indication for the first C-section. "failure_to_progress": Cephalopelvic disproportion/Failure to progress (0 pts). "other": Breach, fetal distress, etc. (1 pt). |
cervical_effacement_percent |
Numeric. Cervical effacement at admission in percent (0-100). <25 25-75 >75 |
cervical_dilation_cm |
Numeric. Cervical dilation at admission in centimeters. (>=4 cm adds 1 point). |
Value
A list containing:
Flamm_Score |
The calculated total score (Range 0-10). |
Probability_Successful_VBAC |
Estimated percentage probability of successful vaginal delivery. |
References
Flamm BL, Geiger AM. Vaginal birth after cesarean delivery: an admission scoring system. Obstet Gynecol. 1997;90(6):907-910. doi:10.1016/s0029-7844(97)00531-0
Examples
# Example 1: High Probability
# 30yo (+2), Prior VBAC (+2), Breech (+1), 80% effaced (+2), 5cm (+1)
# Score = 8
flamm_vbac_score(30, "after", "other", 80, 5)
# Example 2: Low Probability
# 41yo (0), No vaginal hx (0), Failure to progress (0), 0% effaced (0), 1cm (0)
# Score = 0
flamm_vbac_score(41, "none", "failure_to_progress", 0, 1)
Fleischner Society Guidelines for Incidental Pulmonary Nodules (2017)
Description
Provides follow-up recommendations for incidental pulmonary nodules detected on CT scans in patients >= 35 years old. The guidelines differentiate management based on nodule consistency (Solid, Pure Ground-Glass, Part-Solid), multiplicity, size, and patient risk factors (smoking history, exposure).
Usage
fleischner_nodule_guidelines(nodule_type, multiplicity, size_mm,
risk_level = "low")
Arguments
nodule_type |
String. Consistency of the nodule. Options: "solid", "ground_glass", or "part_solid". |
multiplicity |
String. Number of nodules. Options: "single" or "multiple". |
size_mm |
Numeric. Size of the nodule (average diameter) in millimeters. For multiple nodules, use the size of the largest/most suspicious nodule. |
risk_level |
String. Patient risk status. Options: "low" (minimal/no history of smoking or other known risk factors) or "high" (history of smoking or other known risk factors). Defaults to "low". |
Value
A list containing:
Guideline_Recommendation |
The specific follow-up action plan (e.g., intervals for CT surveillance). |
References
MacMahon H, Naidich DP, Goo JM, et al. Guidelines for Management of Incidental Pulmonary Nodules Detected on CT Images: From the Fleischner Society 2017. Radiology. 2017;284(1):228-243. doi:10.1148/radiol.2017161659
Examples
# Example 1: Low Risk, Single Solid Nodule < 6mm
# Result: No follow-up
fleischner_nodule_guidelines("solid", "single", 4, "low")
# Example 2: Single Part-Solid Nodule >= 6mm
# Result: CT at 3-6 months
fleischner_nodule_guidelines("part_solid", "single", 8, "low")
# Example 3: High Risk, Single Solid Nodule 7mm
# Result: CT 6-12 mo, then 18-24 mo
fleischner_nodule_guidelines("solid", "single", 7, "high")
Calculate FLI (Fatty Liver Index)
Description
Using non-SI/SI lab values and measurements, diagnose the risk of having a fatty liver without the need for liver ultrasound. Created by Bedogni et al. 2006, this index has been validated by Cuthberson et al. 2014 and Koehler et al. 2013 for use in multimodal populations, with FLI values of <30 being low risk of fatty liver (LR= -0.2), FLI betwen 30 and 60 being indeterminate of risk, and FLI >60 indicative of high risk of fatty liver (LR = 4.3).
Usage
fli(trigly, bmi, waist, ggt, units = "")
Arguments
trigly |
Numeric value of triglycerides in either SI (mmol/L) or non-SI (mg/dL). |
bmi |
Numeric value of BMI in kg/m^2. |
waist |
Numeric value of waist circumference in cm. |
ggt |
Numeric value of gamma glutyl transpeptidase (GGT) in U/L. |
units |
String to specify non-SI units by not including units argument or SI units by including units="SI". |
Value
A numeric value/vector with predicted fatty liver index value.
References
Bedogni, G., Bellentani, S., Miglioli, L. et al. The Fatty Liver Index: a simple and accurate predictor of hepatic steatosis in the general population. BMC Gastroenterol 6, 33 (2006). https://doi.org/10.1186/1471-230X-6-33 Cuthbertson DJ, Weickert MO, Lythgoe D, et al. External validation of the fatty liver index and lipid accumulation product indices, using 1H-magnetic resonance spectroscopy, to identify hepatic steatosis in healthy controls and obese, insulin-resistant individuals. Eur J Endocrinol. 2014;171(5):561-569. doi:10.1530/EJE-14-0112 Koehler EM, Schouten JN, Hansen BE, Hofman A, Stricker BH, Janssen HL. External validation of the fatty liver index for identifying nonalcoholic fatty liver disease in a population-based study. Clin Gastroenterol Hepatol. 2013;11(9):1201-4.
Examples
# For non-SI measurements, the function is defined as
fli(125, 20, 25, 16)
# For SI measurements, the function is defined as
fli(1.5, 20, 25, 16, units = "SI")
Follicular Lymphoma International Prognostic Index (FLIPI)
Description
Calculates the FLIPI score to predict overall survival in patients with follicular lymphoma. The score uses five adverse prognostic factors: Age >= 60, Ann Arbor Stage III-IV, Hemoglobin < 12 g/dL, Elevated LDH, and > 4 Nodal sites involved.
Usage
flipi_score(age, ann_arbor_stage, hemoglobin_g_dl, ldh_elevated,
num_nodal_sites)
Arguments
age |
Numeric. Patient age in years. (>= 60 years adds +1 point). |
ann_arbor_stage |
Numeric (1-4). Ann Arbor Stage. (Stage III or IV adds +1 point). |
hemoglobin_g_dl |
Numeric. Hemoglobin level in g/dL. (< 12 g/dL adds +1 point). |
ldh_elevated |
Numeric (0 or 1). Serum LDH greater than the upper limit of normal. (1 = Yes, +1 point). |
num_nodal_sites |
Numeric. Count of involved nodal areas. (> 4 sites adds +1 point). |
Value
A list containing:
FLIPI_Score |
The calculated score (Range 0-5). |
Risk_Group |
Classification (Low 0-1, Intermediate 2, High >=3). |
Est_10_Year_Survival |
Estimated 10-year overall survival percentage. |
References
Solal-Céligny P, Roy P, Colombat P, et al. Follicular lymphoma international prognostic index. Blood. 2004;104(5):1258-1265. doi:10.1182/blood-2003-12-4434
Examples
# Example 1: High Risk
# 65yo (+1), Stage IV (+1), Hb 11 (+1), Normal LDH (0), 3 Nodes (0)
# Score = 3
flipi_score(65, 4, 11.0, 0, 3)
# Example 2: Low Risk
# 50yo (0), Stage II (0), Hb 13 (0), High LDH (+1), 2 Nodes (0)
# Score = 1
flipi_score(50, 2, 13.0, 1, 2)
Fomepizole Dosing for Toxic Alcohol Ingestion
Description
Calculates the recommended weight-based dosing regimen for Fomepizole (Antizol), an antidote used in confirmed or suspected ethylene glycol or methanol poisoning. The standard protocol involves a loading dose followed by maintenance doses, with specific frequency adjustments required during hemodialysis due to the drug's dialyzability.
Usage
fomepizole_dosing(weight_kg, on_hemodialysis = 0)
Arguments
weight_kg |
Numeric. Patient's actual body weight in kilograms. |
on_hemodialysis |
Numeric (0 or 1). Is the patient currently undergoing or about to undergo hemodialysis? (1 = Yes, 0 = No). This alters the recommended dosing frequency. |
Value
A list containing:
Weight_Used_kg |
The weight used for calculations. |
Calculated_Dosing_Regimen |
A list detailing the Loading Dose, Maintenance Doses (Initial and Prolonged), and specific adjustments for dialysis if applicable. |
References
Antizol (fomepizole) [package insert]. Jazz Pharmaceuticals, Inc. Palo Alto, CA; 2021. Brent J, McMartin K, Phillips S, et al. Fomepizole for the treatment of ethylene glycol poisoning. Methylpyrazole for Toxic Alcohols Study Group. N Engl J Med. 1999;340(11):832-838. doi:10.1056/NEJM199903183401102
Examples
# Example 1: Standard Patient
# 70 kg, not on dialysis
fomepizole_dosing(70, 0)
# Example 2: Patient on Dialysis
# 80 kg, active hemodialysis
fomepizole_dosing(80, 1)
Fong Clinical Risk Score (CRS) for Colorectal Cancer Recurrence
Description
Calculates the Fong Clinical Risk Score (CRS) to predict recurrence and survival in patients undergoing resection of hepatic metastases from colorectal cancer. The score is based on five clinical criteria: nodal status of the primary tumor, disease-free interval, number of hepatic tumors, preoperative CEA level, and size of the largest hepatic tumor.
Usage
fong_crs_score(nodal_status_primary, disease_free_interval_lt_12mo,
num_tumors_gt_1, preop_cea_gt_200, largest_tumor_gt_5cm)
Arguments
nodal_status_primary |
Numeric (0 or 1). Node-positive primary tumor. (1 = Yes, +1 point). |
disease_free_interval_lt_12mo |
Numeric (0 or 1). Disease-free interval from primary diagnosis to discovery of liver metastases < 12 months. (1 = Yes, +1 point). |
num_tumors_gt_1 |
Numeric (0 or 1). Number of hepatic tumors > 1. (1 = Yes, +1 point). |
preop_cea_gt_200 |
Numeric (0 or 1). Preoperative Carcinoembryonic Antigen (CEA) level > 200 ng/mL. (1 = Yes, +1 point). |
largest_tumor_gt_5cm |
Numeric (0 or 1). Size of the largest hepatic tumor > 5 cm. (1 = Yes, +1 point). |
Value
A list containing:
Fong_Score |
The calculated risk score (Range 0-5). |
Risk_Group |
Classification (Low, Intermediate, High). |
Est_5_Year_Survival |
Estimated 5-year survival probability. |
Median_Survival |
Estimated median survival time in months. |
References
Fong Y, Fortner J, Sun RL, Brennan MF, Blumgart LH. Clinical score for predicting recurrence after hepatic resection for metastatic colorectal cancer: analysis of 1001 consecutive cases. Ann Surg. 1999;230(3):309-318. doi:10.1097/00000658-199909000-00004
Examples
# Example 1: High Risk
# Node+ Primary, DFI < 12mo, Multiple tumors, CEA 50, Size 3cm
# Score = 1 + 1 + 1 + 0 + 0 = 3
fong_crs_score(1, 1, 1, 0, 0)
# Example 2: Low Risk
# Node Negative, DFI > 12mo, Single tumor, CEA < 200, Size < 5cm
# Score = 0
fong_crs_score(0, 0, 0, 0, 0)
Forrest Classification for Upper GI Bleeding
Description
Retrieves the Forrest Classification, associated rebleeding risk, and management recommendations for patients with upper gastrointestinal hemorrhage based on endoscopic findings. This system is used to stratify high-risk lesions requiring endoscopic intervention from low-risk lesions suitable for standard medical therapy or early discharge.
Usage
forrest_classification(endoscopic_finding)
Arguments
endoscopic_finding |
String. The specific finding observed during endoscopy. Options: "spurting_hemorrhage" (Active pulsatile bleeding). "oozing_hemorrhage" (Active non-pulsatile bleeding). "visible_vessel" (Non-bleeding visible vessel). "adherent_clot" (Adherent clot). "flat_pigmented_spot" (Flat pigmented spot/hematin). "clean_base" (Clean ulcer base). |
Value
A list containing:
Forrest_Class |
The classification grade (Ia, Ib, IIa, IIb, IIc, or III). |
Risk_of_Rebleeding |
Estimated probability of rebleeding if untreated. |
Mortality_Risk |
Estimated mortality risk. |
Management_Recommendation |
Guidance on the need for endoscopic hemostasis. |
References
Forrest JA, Finlayson ND, Shearman DJ. Endoscopy in gastrointestinal bleeding. Lancet. 1974;2(7877):394-397. doi:10.1016/s0140-6736(74)91770-x
Examples
# Example 1: High Risk
# Active spurting bleeding
forrest_classification("spurting_hemorrhage")
# Example 2: Low Risk
# Clean ulcer base
forrest_classification("clean_base")
Full Outline of UnResponsiveness (FOUR) Score
Description
Calculates the FOUR Score, a neurological grading scale designed to assess patients with impaired consciousness. Unlike the Glasgow Coma Scale (GCS), the FOUR Score includes assessment of brainstem reflexes and respiration patterns, making it more suitable for intubated patients.
Usage
four_score(eye_response, motor_response, brainstem_reflexes, respiration_pattern)
Arguments
eye_response |
Numeric (0-4). 4: Eyelids open or opened, tracking, or blinking to command. 3: Eyelids open but not tracking. 2: Eyelids closed but open to loud voice. 1: Eyelids closed but open to pain. 0: Eyelids remain closed with pain. |
motor_response |
Numeric (0-4). 4: Thumbs-up, fist, or peace sign. 3: Localizing to pain. 2: Flexion response to pain. 1: Extension response to pain. 0: No response to pain or generalized myoclonus status. |
brainstem_reflexes |
Numeric (0-4). 4: Pupil and corneal reflexes present. 3: One pupil wide and fixed. 2: Pupil or corneal reflexes absent. 1: Pupil and corneal reflexes absent. 0: Absent pupil, corneal, and cough reflex. |
respiration_pattern |
Numeric (0-4). 4: Not intubated, regular breathing pattern. 3: Not intubated, Cheyne-Stokes breathing pattern. 2: Not intubated, irregular breathing. 1: Breathes above ventilator rate. 0: Breathes at ventilator rate or apnea. |
Value
A list containing:
FOUR_Score |
The calculated total score (Range 0-16). |
Interpretation |
Prognostic guidance based on the score (Lower scores indicate higher mortality). |
References
Wijdicks EF, Bamlet WR, Maramattom BV, Manno EM, McClelland RL. Validation of a new coma scale: The FOUR score. Ann Neurol. 2005;58(4):585-593. doi:10.1002/ana.20611
Examples
# Example 1: Comatose/Intubated (High Severity)
# Eyes closed to pain (0), Extension (1), Absent reflexes (0), Vent rate (0)
# Score = 1
four_score(0, 1, 0, 0)
# Example 2: Conscious
# Tracking (4), Thumbs up (4), Reflexes intact (4), Regular breath (4)
# Score = 16
four_score(4, 4, 4, 4)
Fracture Index (SOF) for Postmenopausal Women
Description
Calculates the Fracture Index (based on the Study of Osteoporotic Fractures) to predict the 5-year risk of hip, vertebral, or any non-vertebral fracture in postmenopausal women without using Bone Mineral Density (BMD). The score aggregates simple clinical risk factors including age, fracture history, maternal history, weight, smoking status, and functional mobility (chair rise).
Usage
fracture_index_score(age, history_fracture_after_50, maternal_hip_fracture,
weight_lt_57kg, smoker, uses_arms_to_stand)
Arguments
age |
Numeric. Patient age in years. <65: 0 pts. 65-69: 1 pt. 70-74: 2 pts. 75-79: 3 pts. >=80: 4 pts. |
history_fracture_after_50 |
Numeric (0 or 1). History of any fracture after age 50. (1 = Yes, +1 pt). |
maternal_hip_fracture |
Numeric (0 or 1). History of hip fracture in the patient's mother after age 50. (1 = Yes, +1 pt). |
weight_lt_57kg |
Numeric (0 or 1). Does the patient weigh less than 57 kg (125 lbs)? (1 = Yes, +1 pt). |
smoker |
Numeric (0 or 1). Is the patient a current smoker? (1 = Yes, +1 pt). |
uses_arms_to_stand |
Numeric (0 or 1). Does the patient need to use their arms to stand up from a chair? (1 = Yes, +1 pt). |
Value
A list containing:
Fracture_Index_Score |
The calculated score (Range 0-9+). |
Est_5Yr_Hip_Fracture_Risk |
Estimated percentage risk of hip fracture over 5 years. |
Est_5Yr_Any_Fracture_Risk |
Estimated percentage risk of any non-vertebral fracture over 5 years. |
Bone_Density_Correlation |
General correlation with BMD status (e.g., Osteoporosis likelihood). |
References
Black DM, Steinbuch M, Palermo L, et al. An assessment tool for predicting fracture risk in postmenopausal women. Osteoporos Int. 2001;12(7):519-528. doi:10.1007/s001980170072
Examples
# Example 1: High Risk
# 82yo (+4), Prior Fx (+1), Uses arms (+1)
# Score = 6
fracture_index_score(82, 1, 0, 0, 0, 1)
# Example 2: Low Risk
# 60yo (0), No risk factors
# Score = 0
fracture_index_score(60, 0, 0, 0, 0, 0)
Framingham Risk Score for Hard Coronary Heart Disease
Description
Calculates the 10-year risk of developing hard coronary heart disease (myocardial infarction or coronary death). This score is derived from the NCEP ATP III guidelines.
Usage
framingham_hard_chd(age, sex, smoker, total_cholesterol, hdl_cholesterol,
systolic_bp, bp_medication)
Arguments
age |
Numeric. Patient age in years (20-79). |
sex |
String. Patient sex ("Male" or "Female"). |
smoker |
Numeric (0 or 1). Current smoker. (1 = Yes). |
total_cholesterol |
Numeric. Total Cholesterol level in mg/dL. |
hdl_cholesterol |
Numeric. HDL Cholesterol level in mg/dL. |
systolic_bp |
Numeric. Systolic Blood Pressure in mmHg. |
bp_medication |
Numeric (0 or 1). Is the patient currently on medication for high blood pressure? (1 = Yes). |
Value
A list containing:
Total_Points |
The calculated risk score. |
Ten_Year_Risk_Hard_CHD |
The estimated percentage risk of MI or coronary death in the next 10 years. |
References
Expert Panel on Detection, Evaluation, and Treatment of High Blood Cholesterol in Adults. Executive Summary of The Third Report of The National Cholesterol Education Program (NCEP) Expert Panel on Detection, Evaluation, And Treatment of High Blood Cholesterol in Adults (Adult Treatment Panel III). JAMA. 2001;285(19):2486-2497. doi:10.1001/jama.285.19.2486
Examples
# Example 1: Low Risk
# 45yo Male, Non-smoker, Chol 180, HDL 50, SBP 120 (No Meds)
framingham_hard_chd(45, "male", 0, 180, 50, 120, 0)
# Example 2: High Risk
# 65yo Female, Smoker, Chol 240, HDL 35, SBP 150 (Meds)
framingham_hard_chd(65, "female", 1, 240, 35, 150, 1)
Framingham Heart Failure Diagnostic Criteria
Description
Evaluates the Framingham criteria for the clinical diagnosis of congestive heart failure. Diagnosis requires the presence of at least 2 major criteria OR 1 major criterion plus 2 minor criteria. Note: Minor criteria are accepted only if they cannot be attributed to another medical condition.
Usage
framingham_hf_criteria(pnd, orthopnea, elevated_jvp, rales, cardiomegaly,
pulmonary_edema, s3_gallop, hepatojugular_reflux,
weight_loss_response, ankle_edema, night_cough,
dyspnea_on_exertion, hepatomegaly, pleural_effusion,
tachycardia_gt_120, vital_capacity_decrease)
Arguments
pnd |
Numeric (0 or 1). Paroxysmal Nocturnal Dyspnea. (Major Criterion). |
orthopnea |
Numeric (0 or 1). Orthopnea. (Major Criterion). |
elevated_jvp |
Numeric (0 or 1). Elevated Jugular Venous Pressure. (Major Criterion). |
rales |
Numeric (0 or 1). Pulmonary rales. (Major Criterion). |
cardiomegaly |
Numeric (0 or 1). Cardiomegaly on chest X-ray. (Major Criterion). |
pulmonary_edema |
Numeric (0 or 1). Acute pulmonary edema on chest X-ray. (Major Criterion). |
s3_gallop |
Numeric (0 or 1). S3 gallop rhythm on auscultation. (Major Criterion). |
hepatojugular_reflux |
Numeric (0 or 1). Positive hepatojugular reflux. (Major Criterion). |
weight_loss_response |
Numeric (0 or 1). Weight loss > 4.5 kg in 5 days in response to treatment. (Major Criterion). |
ankle_edema |
Numeric (0 or 1). Bilateral ankle edema. (Minor Criterion). |
night_cough |
Numeric (0 or 1). Nocturnal cough. (Minor Criterion). |
dyspnea_on_exertion |
Numeric (0 or 1). Dyspnea on exertion. (Minor Criterion). |
hepatomegaly |
Numeric (0 or 1). Hepatomegaly. (Minor Criterion). |
pleural_effusion |
Numeric (0 or 1). Pleural effusion. (Minor Criterion). |
tachycardia_gt_120 |
Numeric (0 or 1). Heart rate > 120 beats per minute. (Minor Criterion). |
vital_capacity_decrease |
Numeric (0 or 1). Vital capacity decreased by one-third from maximum recorded. (Minor Criterion). |
Value
A list containing:
Result |
Text interpretation indicating whether criteria for Heart Failure are met. |
Criteria_Counts |
The count of Major and Minor criteria identified. |
Diagnosis_Met |
Boolean indicating if the diagnostic threshold was reached. |
References
McKee PA, Castelli WP, McNamara PM, Kannel WB. The natural history of congestive heart failure: the Framingham study. N Engl J Med. 1971;285(26):1441-1446. doi:10.1056/NEJM197112232852601
Examples
# Example 1: Diagnosis Met (2 Major)
# PND (1), Rales (1)
framingham_hf_criteria(1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
# Example 2: Diagnosis Met (1 Major + 2 Minor)
# Orthopnea (1), Ankle Edema (1), Dyspnea on Exertion (1)
framingham_hf_criteria(0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0)
# Example 3: Not Met (3 Minor only)
# Edema (1), Cough (1), DOE (1)
framingham_hf_criteria(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0)
Free Water Deficit in Hypernatremia
Description
Calculates the estimated free water deficit in patients with hypernatremia. The formula relies on Total Body Water (TBW), which is estimated based on the patient's age, sex, and weight. This calculation helps guide fluid replacement therapy to lower serum sodium levels safely.
Usage
free_water_deficit(current_na, weight_kg, age, sex, target_na = 140)
Arguments
current_na |
Numeric. Current serum sodium level in mEq/L. |
weight_kg |
Numeric. Patient weight in kilograms. |
age |
Numeric. Patient age in years. Used to determine the TBW fraction (Children: 0.6; Adults 18-64: M=0.6/F=0.5; Elderly >=65: M=0.5/F=0.45). |
sex |
String. Patient sex ("Male" or "Female"). |
target_na |
Numeric. The desired target serum sodium level. Defaults to 140 mEq/L. |
Value
A list containing:
Free_Water_Deficit_L |
The estimated volume of free water required to correct the sodium to the target level. |
Total_Body_Water_L |
The estimated Total Body Water used in the calculation. |
TBW_Fraction_Used |
The coefficient used to calculate TBW based on demographics. |
References
Adrogué HJ, Madias NE. Hypernatremia. N Engl J Med. 2000;342(20):1493-1499. doi:10.1056/NEJM200005183422006
Examples
# Example 1: Adult Male
# Na 160, Wt 75kg, Age 40 (TBW factor 0.6)
# TBW = 45L. Deficit = 45 * ((160/140) - 1) = 6.4 L
free_water_deficit(160, 75, 40, "male")
# Example 2: Elderly Female
# Na 155, Wt 60kg, Age 75 (TBW factor 0.45)
# TBW = 27L. Deficit = 27 * ((155/140) - 1) = 2.9 L
free_water_deficit(155, 60, 75, "female")
Fuhrman Nuclear Grade for Clear Cell Renal Carcinoma
Description
Determines the Fuhrman Nuclear Grade for renal cell carcinoma (RCC). This histologic grading system is a powerful predictor of metastasis and survival in clear cell RCC. It evaluates nuclear size, irregularity, and nucleolar prominence.
Usage
fuhrman_nuclear_grade(nuclear_diameter_um, nuclear_shape_irregular,
nucleoli_visible, magnification_needed)
Arguments
nuclear_diameter_um |
Numeric. Approximate diameter of the nuclei in micrometers. ~10 um: Grade 1. ~15 um: Grade 2 or 3. >20 um: Grade 4. |
nuclear_shape_irregular |
Numeric (0 or 1). Are the nuclei irregular in outline? (1 = Yes). |
nucleoli_visible |
Numeric (0 or 1). Are nucleoli visible? (1 = Yes). |
magnification_needed |
String. Magnification required to visualize nucleoli clearly. "400x": High power (Grade 2). "100x": Low power (Grade 3). "10x": Low power (Grade 3). |
Value
A list containing:
Fuhrman_Grade |
The calculated grade (1, 2, 3, or 4). |
Histologic_Description |
Description of the nuclear features for the grade. |
Prognosis |
General prognostic category. |
Est_5_Year_Survival |
Estimated 5-year survival rate based on grade. |
References
Fuhrman SA, Lasky LC, Limas C. Prognostic significance of morphologic parameters in renal cell carcinoma. Am J Surg Pathol. 1982;6(7):655-663.
Examples
# Example 1: Grade 2
# 15um, irregular, nucleoli visible at 400x
fuhrman_nuclear_grade(15, 1, 1, "400x")
# Example 2: Grade 4
# 25um, bizarre shape, prominent nucleoli
fuhrman_nuclear_grade(25, 1, 1, "10x")
FUNC Score for ICH Functional Outcome
Description
Calculates the FUNC Score to predict the probability of functional independence (GCS >= 4) at 90 days in patients with primary intracerebral hemorrhage (ICH). The score (0-11) evaluates ICH volume, age, location, GCS, and pre-ICH cognitive status. Higher scores indicate a better prognosis.
Usage
func_ich_score(ich_volume_cm3, age, location, gcs, cognitive_impairment_pre_ich)
Arguments
ich_volume_cm3 |
Numeric. Volume of the hematoma in cm^3 (often calculated via ABC/2 method). <30: 4 pts. 30-60: 2 pts. >60: 0 pts. |
age |
Numeric. Patient age in years. <70: 2 pts. 70-79: 1 pt. >=80: 0 pts. |
location |
String. Location of the hemorrhage. Options: "lobar" (2 pts), "deep" (1 pt), "infratentorial" (0 pts). |
gcs |
Numeric. Glasgow Coma Scale score on admission. >=9: 2 pts. <=8: 0 pts. |
cognitive_impairment_pre_ich |
Numeric (0 or 1). Presence of cognitive impairment prior to the ICH. (1 = Yes: 0 pts, 0 = No: 1 pt). |
Value
A list containing:
FUNC_Score |
The calculated score (Range 0-11). |
Prob_Functional_Independence_90_Day |
Estimated probability of achieving functional independence at 90 days. |
References
Rost NS, Smith EE, Chang Y, et al. Prediction of functional outcome in patients with primary intracerebral hemorrhage: the FUNC score. Stroke. 2008;39(8):2304-2309. doi:10.1161/STROKEAHA.107.512202
Examples
# Example 1: Good Prognosis
# Vol 15 (<30 -> 4), Age 60 (<70 -> 2), Lobar (2), GCS 14 (2), No impairment (1)
# Score = 11
func_ich_score(15, 60, "lobar", 14, 0)
# Example 2: Poor Prognosis
# Vol 40 (30-60 -> 2), Age 82 (0), Deep (1), GCS 7 (0), Impairment Yes (0)
# Score = 3
func_ich_score(40, 82, "deep", 7, 1)
G8 Geriatric Screening Tool
Description
Calculates the G8 score, a screening tool developed to identify elderly cancer patients who would benefit from a Comprehensive Geriatric Assessment (CGA). The score consists of 7 items from the Mini Nutritional Assessment (MNA) and patient age. A score of 14 or lower indicates vulnerability or frailty.
Usage
g8_geriatric_screen(food_intake, weight_loss, mobility, neuropsychological,
bmi_score, more_than_3_meds, self_rated_health, age)
Arguments
food_intake |
Numeric (0-2). Has food intake declined over the past 3 months? 0: Severe decrease in food intake. 1: Moderate decrease in food intake. 2: No decrease in food intake. |
weight_loss |
Numeric (0-3). Weight loss during the last 3 months. 0: Weight loss > 3 kg. 1: Does not know. 2: Weight loss between 1 and 3 kg. 3: No weight loss. |
mobility |
Numeric (0-2). Mobility status. 0: Bed or chair bound. 1: Able to get out of bed/chair but does not go out. 2: Goes out. |
neuropsychological |
Numeric (0-2). Neuropsychological problems. 0: Severe dementia or depression. 1: Mild dementia. 2: No psychological problems. |
bmi_score |
Numeric (0-3). Body Mass Index (BMI). 0: BMI < 19. 1: BMI 19 - <21. 2: BMI 21 - <23. 3: BMI >= 23. |
more_than_3_meds |
Numeric (0 or 1). Takes more than 3 prescription drugs per day. (1 = Yes, 0 = No). Note: "No" adds 1 point to the score. |
self_rated_health |
Numeric (0, 0.5, 1, 2). In comparison with other people of the same age, how does the patient consider their health status? 0: Not as good. 0.5: Does not know. 1: As good. 2: Better. |
age |
Numeric. Patient age in years. < 80: 2 points. 80-85: 1 point. > 85: 0 points. |
Value
A list containing:
G8_Score |
The calculated total score (Range 0-17). |
Interpretation |
Clinical recommendation regarding the need for full geriatric assessment. |
References
Bellera CA, Rainfray M, Mathoulin-Pélissier S, et al. Screening older cancer patients: first evaluation of the G-8 geriatric screening tool. Ann Oncol. 2012;23(8):2166-2172. doi:10.1093/annonc/mdr587
Examples
# Example 1: Frail Patient
# Severe food decline (0), Wt loss >3kg (0), Bed bound (0), Dementia (0),
# BMI <19 (0), Polypharmacy (1), Poor health (0), Age 86 (0)
# Score = 0
g8_geriatric_screen(0, 0, 0, 0, 0, 1, 0, 86)
# Example 2: Fit Patient
# No decline (2), No wt loss (3), Goes out (2), No neuro (2),
# BMI >23 (3), No polypharmacy (0), Better health (2), Age 75 (2)
# Score = 2+3+2+2+3+1+2+2 = 17
g8_geriatric_screen(2, 3, 2, 2, 3, 0, 2, 75)
GAD-7 (General Anxiety Disorder-7)
Description
Calculates the GAD-7 score, a brief 7-item screening tool for Generalized Anxiety Disorder (GAD). It is also useful for screening Panic Disorder, Social Anxiety Disorder, and PTSD. Scores of 5, 10, and 15 represent cutpoints for mild, moderate, and severe anxiety, respectively.
Usage
gad7_anxiety_screen(q1, q2, q3, q4, q5, q6, q7)
Arguments
q1 |
Numeric (0-3). Feeling nervous, anxious, or on edge. |
q2 |
Numeric (0-3). Not being able to stop or control worrying. |
q3 |
Numeric (0-3). Worrying too much about different things. |
q4 |
Numeric (0-3). Trouble relaxing. |
q5 |
Numeric (0-3). Being so restless that it is hard to sit still. |
q6 |
Numeric (0-3). Becoming easily annoyed or irritable. |
q7 |
Numeric (0-3). Feeling afraid as if something awful might happen. |
Details
Scoring Key (Over the last 2 weeks): 0 = Not at all 1 = Several days 2 = More than half the days 3 = Nearly every day
Value
A list containing:
GAD7_Score |
The calculated total score (Range 0-21). |
Severity_Category |
Interpretation (Minimal, Mild, Moderate, Severe). |
Screening_Result |
Clinical guidance based on the cutoff of 10. |
References
Spitzer RL, Kroenke K, Williams JB, Löwe B. A brief measure for assessing generalized anxiety disorder: the GAD-7. Arch Intern Med. 2006;166(10):1092-1097. doi:10.1001/archinte.166.10.1092
Examples
# Example 1: Moderate Anxiety (Positive Screen)
# Mostly "More than half the days" (2)
gad7_anxiety_screen(2, 2, 1, 2, 1, 2, 1)
# Example 2: Minimal Anxiety (Negative Screen)
# Mostly "Not at all" (0)
gad7_anxiety_screen(0, 1, 0, 0, 0, 0, 0)
Gail Model for Breast Cancer Risk Assessment (BCRAT)
Description
Calculates the Relative Risk (RR) of developing invasive breast cancer using the Gail Model algorithm (NCI BCRAT). This function computes the composite risk factor based on age, menarche, reproductive history, family history, and biopsy history. Note: The absolute 5-year and lifetime percentage risks require integration with large actuarial baseline hazard tables which are not embedded here; this function provides the core relative risk multiplier.
Usage
gail_model_risk(age, age_menarche, age_first_live_birth,
num_first_degree_relatives, num_biopsies,
atypical_hyperplasia, race = "white")
Arguments
age |
Numeric. Current patient age in years (valid 35+). |
age_menarche |
Numeric. Age at onset of first menstrual period. |
age_first_live_birth |
Numeric. Age at time of first live birth. Use 0 if nulliparous. |
num_first_degree_relatives |
Numeric. Number of first-degree relatives (mother, sisters, daughters) with breast cancer. |
num_biopsies |
Numeric. Number of previous breast biopsies (0, 1, or 2 for >=2). |
atypical_hyperplasia |
Numeric (0 or 1). History of atypical hyperplasia in biopsies. (1 = Yes, 0 = No, or unknown). Applicable only if num_biopsies > 0. |
race |
String. Patient race/ethnicity (e.g., "white"). Note: This implementation uses coefficients standard for White females (Gail Model 2); relative risk weights may vary slightly for other populations in the full NCI tool. |
Value
A list containing:
Relative_Risk |
The calculated relative risk score compared to a woman of the same age with no risk factors (RR=1.0). |
Interpretation |
Context regarding the conversion of RR to absolute probability. |
References
Gail MH, Brinton LA, Byar DP, et al. Projecting individualized probabilities of developing breast cancer for white females who are being examined annually. J Natl Cancer Inst. 1989;81(24):1879-1886. doi:10.1093/jnci/81.24.1879 Costantino JP, Gail MH, Pee D, et al. Validation studies for models projecting the risk of invasive and total breast cancer incidence. J Natl Cancer Inst. 1999;91(18):1541-1548.
Examples
# Example 1: High Risk
# 55yo, Menarche 11, 1st Birth 30, 2 Relatives, 1 Biopsy (w/ Hyperplasia)
gail_model_risk(55, 11, 30, 2, 1, 1)
# Example 2: Low Risk
# 40yo, Menarche 14, 1st Birth 22, 0 Relatives, 0 Biopsies
gail_model_risk(40, 14, 22, 0, 0, 0)
GALAD Model for Hepatocellular Carcinoma (HCC)
Description
Calculates the GALAD score (Gender, Age, AFP-L3, AFP, DCP) to estimate the probability of Hepatocellular Carcinoma (HCC) in patients with chronic liver disease. This serum biomarker-based model demonstrates high sensitivity and specificity for detecting early-stage HCC, often outperforming AFP alone.
Usage
galad_score_hcc(sex, age, afp, afp_l3, dcp)
Arguments
sex |
String. Patient sex ("Male" or "Female"). (Male adds 1.67 to the Z-score). |
age |
Numeric. Patient age in years. |
afp |
Numeric. Alpha-fetoprotein level in ng/mL. |
afp_l3 |
Numeric. Lens culinaris agglutinin-reactive fraction of AFP in percentage (%). |
dcp |
Numeric. Des-gamma-carboxy prothrombin level in ng/mL. |
Value
A list containing:
GALAD_Score_Z |
The linear predictor score (Z). |
Probability_HCC |
The estimated probability of having HCC. |
Risk_Category |
Assessment based on standard cutoffs (e.g., Z > -0.63 suggests higher risk). |
References
Johnson PJ, Pirrie SJ, Cox TF, et al. The detection of hepatocellular carcinoma using a prospectively developed and validated model based on serological biomarkers. Cancer Epidemiol Biomarkers Prev. 2014;23(1):144-153. doi:10.1158/1055-9965.EPI-13-0870
Examples
# Example 1: High Risk
# 65yo Male, AFP 10 ng/mL, AFP-L3 5%, DCP 20 ng/mL
# Z-score approx 1.3 -> High Probability (~79%)
galad_score_hcc("male", 65, 10, 5, 20)
# Example 2: Low Risk
# 40yo Female, AFP 3 ng/mL, AFP-L3 1%, DCP 5 ng/mL
# Z-score approx -4.5 -> Low Probability (<2%)
galad_score_hcc("female", 40, 3, 1, 5)
Ganzoni Equation for Iron Deficiency Anemia
Description
Calculates the total body iron deficit in milligrams using the Ganzoni equation. This value determines the total dose of parenteral iron required for complete repletion in patients with iron deficiency anemia.
Usage
ganzoni_iron_deficit(weight_kg, actual_hb, target_hb = 13, iron_stores_mg = 500)
Arguments
weight_kg |
Numeric. Patient body weight in kilograms. |
actual_hb |
Numeric. Patient's current hemoglobin level in g/dL. |
target_hb |
Numeric. Target hemoglobin level in g/dL. Defaults to 13 g/dL (commonly used standard), but can be adjusted based on patient age, sex, or population. |
iron_stores_mg |
Numeric. Estimated iron stores in milligrams. Defaults to 500 mg (standard for adults). For children or smaller individuals, a lower value (e.g., 15 mg/kg if weight < 35 kg) might be appropriate. |
Details
The formula is:
Total Iron Deficit (mg) = [Weight (kg) \times (Target Hb - Actual Hb) (g/dL) \times 2.4] + Iron Stores (mg)
Value
A list containing:
Total_Iron_Deficit_mg |
The calculated total iron deficit in milligrams. |
Formula |
A string representation of the calculation performed. |
References
Ganzoni AM. Intravenous iron-dextran: therapeutic and experimental possibilities. Schweiz Med Wochenschr. 1970;100(7):301-303.
Examples
# Example 1: Standard Adult
# 70 kg, Hb 8 g/dL, Target 13 g/dL, Stores 500 mg
# Deficit = (70 * 5 * 2.4) + 500 = 840 + 500 = 1340 mg
ganzoni_iron_deficit(70, 8)
# Example 2: Customized Target and Stores
# 50 kg, Hb 10 g/dL, Target 12 g/dL, Stores 0 mg (Conservative)
# Deficit = (50 * 2 * 2.4) + 0 = 240 mg
ganzoni_iron_deficit(50, 10, target_hb = 12, iron_stores_mg = 0)
GAP Index for Idiopathic Pulmonary Fibrosis (IPF) Mortality
Description
Calculates the GAP (Gender, Age, Physiology) Index to predict 1-, 2-, and 3-year mortality in patients with Idiopathic Pulmonary Fibrosis. The score stratifies patients into three stages based on four predictors: sex, age, forced vital capacity (FVC), and diffusing capacity of the lung for carbon monoxide (DLCO).
Usage
gap_index_ipf(sex, age, fvc_percent, dlco_percent, dlco_unable_to_perform = 0)
Arguments
sex |
String. Patient sex ("Male" or "Female"). (Male adds 1 point). |
age |
Numeric. Patient age in years. <= 60: 0 pts. 61-65: 1 pt. > 65: 2 pts. |
fvc_percent |
Numeric. Predicted Forced Vital Capacity (FVC) percentage. > 75%: 0 pts. 50-75%: 1 pt. < 50%: 2 pts. |
dlco_percent |
Numeric. Predicted Diffusing Capacity of the Lung for Carbon Monoxide (DLCO) percentage. Required if 'dlco_unable_to_perform' is 0. > 55%: 0 pts. 36-55%: 1 pt. <= 35%: 2 pts. |
dlco_unable_to_perform |
Numeric (0 or 1). Is the patient unable to perform the DLCO maneuver? (1 = Yes). If Yes, score is 3 points for this category. |
Value
A list containing:
GAP_Score |
The calculated total score (Range 0-8). |
GAP_Stage |
The disease stage (I, II, or III). |
Mortality_Risk |
Estimated mortality rates at 1, 2, and 3 years. |
References
Ley B, Ryerson CJ, Vittinghoff E, et al. A multidimensional index and staging system for idiopathic pulmonary fibrosis. Ann Intern Med. 2012;156(10):684-691. doi:10.7326/0003-4819-156-10-201205150-00004
Examples
# Example 1: Stage I (Low Risk)
# Female (0), 55yo (0), FVC 80% (0), DLCO 60% (0)
# Score = 0
gap_index_ipf("female", 55, 80, 60)
# Example 2: Stage III (High Risk)
# Male (1), 70yo (2), FVC 45% (2), DLCO Unable (3)
# Score = 1 + 2 + 2 + 3 = 8
gap_index_ipf("male", 70, 45, 0, 1)
GARFIELD-AF Risk Calculator
Description
Structures the clinical inputs for the GARFIELD-AF Risk Calculator. This integrated risk tool estimates the 1-year and 2-year risks of all-cause mortality, stroke/systemic embolism, and major bleeding in patients with newly diagnosed atrial fibrillation. It accounts for demographics, vital signs, comorbidities, and antithrombotic treatment.
Usage
garfield_af_risk_score(sex, age, weight_kg, heart_rate, systolic_bp,
chf_history, acs_history, history_stroke_tia,
history_bleeding, ckd_stage_3_to_5, diabetes,
treatment_type)
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age |
Numeric. Patient age in years. |
weight_kg |
Numeric. Patient weight in kilograms. |
heart_rate |
Numeric. Heart rate in beats per minute. |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
chf_history |
Numeric (0 or 1). History of Congestive Heart Failure. (1 = Yes). |
acs_history |
Numeric (0 or 1). History of Acute Coronary Syndrome. (1 = Yes). |
history_stroke_tia |
Numeric (0 or 1). History of Stroke, TIA, or Systemic Embolism. (1 = Yes). |
history_bleeding |
Numeric (0 or 1). History of bleeding. (1 = Yes). |
ckd_stage_3_to_5 |
Numeric (0 or 1). Moderate to severe Chronic Kidney Disease (Stage 3-5). (1 = Yes). |
diabetes |
Numeric (0 or 1). Diabetes Mellitus. (1 = Yes). |
treatment_type |
String. Current antithrombotic treatment. Options: "none", "vka" (Vitamin K Antagonist), "doac" (Direct Oral Anticoagulant), "antiplatelet", "combination". |
Value
A list containing:
Patient_Profile |
Summary of demographics and vitals. |
Risk_Factors_Identified |
List of positive risk factors contributing to the score. |
Note |
Guidance regarding the regression model used for the final percentage output. |
References
Fox KAA, Lucas JE, Pieper KS, et al. Improved risk stratification of patients with atrial fibrillation: an integrated GARFIELD-AF tool for the prediction of mortality, stroke and bleeding in patients with and without anticoagulation. BMJ Open. 2017;7(12):e017157. doi:10.1136/bmjopen-2017-017157
Examples
# Example 1: Multiple Comorbidities
# 75yo Male, CHF, Prior Stroke, on VKA
garfield_af_risk_score("male", 75, 80, 72, 130, 1, 0, 1, 0, 0, 0, "vka")
# Example 2: Low Comorbidity
# 55yo Female, No history, on Antiplatelet
garfield_af_risk_score("female", 55, 60, 68, 120, 0, 0, 0, 0, 0, 0, "antiplatelet")
GCS-Pupils (GCS-P) Score
Description
Calculates the GCS-P score, which combines the standard Glasgow Coma Scale (GCS) with an assessment of pupil reactivity. This score extends the range of injury severity assessment, particularly for patients with severe TBI (GCS 3), by subtracting points for unreactive pupils. The score ranges from 1 to 15.
Usage
gcs_pupils_score(gcs_total, pupils_unreactive_count)
Arguments
gcs_total |
Numeric (3-15). The standard total Glasgow Coma Scale score (Eye + Verbal + Motor). |
pupils_unreactive_count |
Numeric (0, 1, or 2). The number of pupils unreactive to light. 0: Both pupils reactive (Score adjustment: 0). 1: One pupil unreactive (Score adjustment: -1). 2: Both pupils unreactive (Score adjustment: -2). |
Value
A list containing:
GCS_P_Score |
The calculated GCS-P score (Range 1-15). |
Interpretation |
General mortality risk trend associated with the score. |
References
Brennan PM, Murray GD, Teasdale GM. Simplifying the use of prognostic information in traumatic brain injury. Part 1: The GCS-Pupils score: an extended index of clinical severity. J Neurosurg. 2018;128(6):1612-1620. doi:10.3171/2017.12.JNS172780
Examples
# Example 1: Severe TBI with blown pupils
# GCS 3, 2 unreactive pupils
# Score = 3 - 2 = 1
gcs_pupils_score(3, 2)
# Example 2: Moderate TBI
# GCS 10, Reactive pupils
# Score = 10 - 0 = 10
gcs_pupils_score(10, 0)
Geriatric Depression Scale (GDS-15)
Description
Calculates the score for the Geriatric Depression Scale (Short Form). This 15-item screening tool is designed specifically for older adults. Responses are binary (Yes/No), and the scoring algorithm accounts for reverse-coded items where a negative answer indicates depression.
Usage
gds15_depression_screen(satisfied_with_life, dropped_activities, life_empty,
often_bored, good_spirits, afraid_something_bad,
happy_most_time, often_helpless, prefer_stay_home,
memory_problems, wonderful_alive, worthless,
full_energy, hopeless, others_better_off)
Arguments
satisfied_with_life |
Numeric (0 or 1). Are you basically satisfied with your life? (1=Yes, 0=No). Note: 0 scores 1 point. |
dropped_activities |
Numeric (0 or 1). Have you dropped many of your activities and interests? (1=Yes, 0=No). |
life_empty |
Numeric (0 or 1). Do you feel that your life is empty? (1=Yes, 0=No). |
often_bored |
Numeric (0 or 1). Do you often get bored? (1=Yes, 0=No). |
good_spirits |
Numeric (0 or 1). Are you in good spirits most of the time? (1=Yes, 0=No). Note: 0 scores 1 point. |
afraid_something_bad |
Numeric (0 or 1). Are you afraid that something bad is going to happen to you? (1=Yes, 0=No). |
happy_most_time |
Numeric (0 or 1). Do you feel happy most of the time? (1=Yes, 0=No). Note: 0 scores 1 point. |
often_helpless |
Numeric (0 or 1). Do you often feel helpless? (1=Yes, 0=No). |
prefer_stay_home |
Numeric (0 or 1). Do you prefer to stay at home, rather than going out and doing new things? (1=Yes, 0=No). |
memory_problems |
Numeric (0 or 1). Do you feel you have more problems with memory than most? (1=Yes, 0=No). |
wonderful_alive |
Numeric (0 or 1). Do you think it is wonderful to be alive now? (1=Yes, 0=No). Note: 0 scores 1 point. |
worthless |
Numeric (0 or 1). Do you feel pretty worthless the way you are now? (1=Yes, 0=No). |
full_energy |
Numeric (0 or 1). Do you feel full of energy? (1=Yes, 0=No). Note: 0 scores 1 point. |
hopeless |
Numeric (0 or 1). Do you feel that your situation is hopeless? (1=Yes, 0=No). |
others_better_off |
Numeric (0 or 1). Do you think that most people are better off than you are? (1=Yes, 0=No). |
Value
A list containing:
GDS15_Score |
The calculated total score (Range 0-15). |
Interpretation |
Clinical severity (Normal <=4, Mild 5-8, Moderate 9-11, Severe 12-15). |
References
Sheikh JI, Yesavage JA. Geriatric Depression Scale (GDS): recent evidence and development of a shorter version. Clin Gerontol. 1986;5(1/2):165-173.
Examples
# Example 1: Severe Depression
# Answered in the depressive direction for all questions
gds15_depression_screen(0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1)
# Example 2: Normal
# Answered in the positive/healthy direction for all questions
gds15_depression_screen(1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0)
GELF Criteria for Follicular Lymphoma
Description
Evaluates the Groupe d'Etude des Lymphomes Folliculaires (GELF) criteria to determine tumor burden in patients with follicular lymphoma. The presence of at least one criterion indicates high tumor burden, suggesting the need to initiate therapy rather than a "watch and wait" approach.
Usage
gelf_criteria_follicular_lymphoma(nodal_mass_gt_7cm, multiple_nodal_sites_gt_3cm,
systemic_symptoms, spleen_enlargement,
organ_compression, pleural_ascitic_effusion,
ldh_or_beta2_elevated)
Arguments
nodal_mass_gt_7cm |
Numeric (0 or 1). Presence of a nodal mass > 7 cm. (1 = Yes). |
multiple_nodal_sites_gt_3cm |
Numeric (0 or 1). Involvement of >= 3 nodal sites, each > 3 cm. (1 = Yes). |
systemic_symptoms |
Numeric (0 or 1). Presence of systemic symptoms (B symptoms: fever, night sweats, weight loss >10%). (1 = Yes). |
spleen_enlargement |
Numeric (0 or 1). Symptomatic splenic enlargement (splenomegaly). (1 = Yes). |
organ_compression |
Numeric (0 or 1). Compression of a vital organ (e.g., ureteral obstruction, SVC syndrome). (1 = Yes). |
pleural_ascitic_effusion |
Numeric (0 or 1). Presence of pleural effusion or ascites. (1 = Yes). |
ldh_or_beta2_elevated |
Numeric (0 or 1). Elevated serum LDH or Beta-2 Microglobulin levels. (1 = Yes). |
Value
A list containing:
GELF_Result |
"High Tumor Burden" if >= 1 criterion is met, otherwise "Low Tumor Burden". |
Criteria_Count |
Total number of positive criteria. |
Recommendation |
Clinical guidance regarding treatment initiation. |
References
Brice P, Bastion Y, Lepage E, et al. Comparison in low-tumor-burden follicular lymphomas between an initial no-treatment policy, prednimustine, or interferon alfa: a randomized study from the Groupe d'Etude des Lymphomes Folliculaires. Groupe d'Etude des Lymphomes Folliculaires. J Clin Oncol. 1997;15(3):1110-1117. doi:10.1200/JCO.1997.15.3.1110
Examples
# Example 1: High Burden (Need Treatment)
# Large mass > 7cm, No other symptoms
gelf_criteria_follicular_lymphoma(1, 0, 0, 0, 0, 0, 0)
# Example 2: Low Burden (Watch and Wait)
# No criteria met
gelf_criteria_follicular_lymphoma(0, 0, 0, 0, 0, 0, 0)
Geneva Score (Revised) for Pulmonary Embolism
Description
Calculates the Revised Geneva Score to estimate the probability of pulmonary embolism (PE) in patients with suspected PE. This score stratifies patients into low, intermediate, or high clinical pretest probability categories based on clinical variables, aiding in the decision-making process for further diagnostic testing.
Usage
geneva_score_revised(age_gt_65, previous_dvt_pe, surgery_or_fracture_1mo,
active_malignancy, unilateral_lower_limb_pain, hemoptysis,
heart_rate, lower_limb_deep_vein_palpation_edema)
Arguments
age_gt_65 |
Numeric (0 or 1). Age > 65 years. (1 = Yes, +1 point). |
previous_dvt_pe |
Numeric (0 or 1). Previous Deep Vein Thrombosis (DVT) or Pulmonary Embolism (PE). (1 = Yes, +3 points). |
surgery_or_fracture_1mo |
Numeric (0 or 1). Surgery (under general anesthesia) or lower limb fracture within the past month. (1 = Yes, +2 points). |
active_malignancy |
Numeric (0 or 1). Active malignant condition (solid or hematologic malignancy, currently active or considered cured < 1 year). (1 = Yes, +2 points). |
unilateral_lower_limb_pain |
Numeric (0 or 1). Unilateral lower limb pain. (1 = Yes, +3 points). |
hemoptysis |
Numeric (0 or 1). Hemoptysis. (1 = Yes, +2 points). |
heart_rate |
Numeric. Heart rate in beats per minute. (75-94 bpm: +3 points; >= 95 bpm: +5 points). |
lower_limb_deep_vein_palpation_edema |
Numeric (0 or 1). Pain on lower limb deep venous palpation and unilateral edema. (1 = Yes, +4 points). |
Value
A list containing:
Geneva_Score |
The calculated risk score (Range 0-22). |
Risk_Probability |
Classification (Low 0-3, Intermediate 4-10, High >=11). |
PE_Probability |
Estimated probability of PE based on risk category. |
Recommendation |
Suggested diagnostic strategy. |
References
Le Gal G, Righini M, Roy PM, et al. Prediction of pulmonary embolism in the emergency department: the revised Geneva score. Ann Intern Med. 2006;144(3):165-171. doi:10.7326/0003-4819-144-3-200602070-00004
Examples
# Example 1: Low Probability
# 40yo, HR 70, No other risk factors
# Score = 0
geneva_score_revised(0, 0, 0, 0, 0, 0, 70, 0)
# Example 2: High Probability
# 70yo (+1), HR 100 (+5), Unilateral Pain (+3), Pain on Palpation (+4)
# Score = 13
geneva_score_revised(1, 0, 0, 0, 1, 0, 100, 1)
Geneva Risk Score for VTE Prophylaxis
Description
Calculates the Geneva Risk Score for Venous Thromboembolism (VTE) Prophylaxis in hospitalized medical patients. This score stratifies patients into low or high risk to guide the decision for pharmacologic thromboprophylaxis. Note: This is distinct from the "Geneva Score" used for diagnosing PE.
Usage
geneva_vte_prophylaxis_score(heart_failure, respiratory_failure, recent_stroke,
recent_mi, acute_infection, rheumatic_disease,
active_malignancy, myeloproliferative_syndrome,
nephrotic_syndrome, prior_vte, hypercoagulable_state,
immobilization, recent_travel, age_gt_60,
obesity_bmi_gt_30, chronic_venous_insufficiency,
pregnancy, hormonal_therapy, dehydration)
Arguments
heart_failure |
Numeric (0 or 1). Cardiac failure. (1 = Yes, +2 pts). |
respiratory_failure |
Numeric (0 or 1). Respiratory failure. (1 = Yes, +2 pts). |
recent_stroke |
Numeric (0 or 1). Recent stroke (<3 months ago). (1 = Yes, +2 pts). |
recent_mi |
Numeric (0 or 1). Recent myocardial infarction (<4 weeks ago). (1 = Yes, +2 pts). |
acute_infection |
Numeric (0 or 1). Acute infectious disease (including sepsis). (1 = Yes, +2 pts). |
rheumatic_disease |
Numeric (0 or 1). Acute rheumatic disease. (1 = Yes, +2 pts). |
active_malignancy |
Numeric (0 or 1). Active malignancy. (1 = Yes, +2 pts). |
myeloproliferative_syndrome |
Numeric (0 or 1). Myeloproliferative syndrome. (1 = Yes, +2 pts). |
nephrotic_syndrome |
Numeric (0 or 1). Nephrotic syndrome. (1 = Yes, +2 pts). |
prior_vte |
Numeric (0 or 1). Any prior VTE. (1 = Yes, +2 pts). |
hypercoagulable_state |
Numeric (0 or 1). Known hypercoagulable state. (1 = Yes, +2 pts). |
immobilization |
Numeric (0 or 1). Immobilization for >= 3 days (<30 min walking/day). (1 = Yes, +1 pt). |
recent_travel |
Numeric (0 or 1). Recent travel for > 6 hours. (1 = Yes, +1 pt). |
age_gt_60 |
Numeric (0 or 1). Age > 60 years. (1 = Yes, +1 pt). |
obesity_bmi_gt_30 |
Numeric (0 or 1). BMI > 30 kg/m2. (1 = Yes, +1 pt). |
chronic_venous_insufficiency |
Numeric (0 or 1). Chronic venous insufficiency. (1 = Yes, +1 pt). |
pregnancy |
Numeric (0 or 1). Pregnancy. (1 = Yes, +1 pt). |
hormonal_therapy |
Numeric (0 or 1). Hormonal therapy (contraceptive or replacement). (1 = Yes, +1 pt). |
dehydration |
Numeric (0 or 1). Dehydration. (1 = Yes, +1 pt). |
Value
A list containing:
Geneva_Prophylaxis_Score |
The calculated risk score. |
Risk_Category |
"Low Risk" (Score < 3) or "High Risk" (Score >= 3). |
Recommendation |
Clinical guidance regarding prophylaxis. |
References
Nendaz M, Spirk D, Kucher N, et al. Multicentre validation of the Geneva Risk Score for hospitalised medical patients at risk of venous thromboembolism. Thromb Haemost. 2014;111(3):531-538. doi:10.1160/TH13-05-0427
Examples
# Example 1: High Risk
# 70yo (+1), Active Infection (+2)
# Score = 3
geneva_vte_prophylaxis_score(0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0)
# Example 2: Low Risk
# 50yo, Immobilized (+1), Obese (+1)
# Score = 2
geneva_vte_prophylaxis_score(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0)
GI-GPA (Graded Prognostic Assessment for Gastrointestinal Cancers)
Description
Calculates the GI-GPA score, a prognostic index for patients with brain metastases from gastrointestinal cancers. The score uses four factors: Karnofsky Performance Status (KPS), age, presence of extracranial metastases, and number of brain metastases to predict median survival.
Usage
gigpa_score(kps, age, extracranial_metastases, num_brain_metastases)
Arguments
kps |
Numeric. Karnofsky Performance Status score (0-100). >=90: 2.0 pts. 80: 1.5 pts. 70: 1.0 pt. <70: 0 pts. |
age |
Numeric. Patient age in years. <70: 0.5 pts. >=70: 0 pts. |
extracranial_metastases |
Numeric (0 or 1). Presence of extracranial metastases. (1 = Present: 0 pts, 0 = Absent: 1.0 pt). |
num_brain_metastases |
Numeric. Number of brain metastases. 1: 0.5 pts. >1: 0 pts. |
Value
A list containing:
GI_GPA_Score |
The calculated prognostic score (Range 0.0 - 4.0). |
Median_Survival |
Estimated median survival time in months. |
References
Sperduto PW, Kased N, Roberge D, et al. Summary report on the graded prognostic assessment: an accurate and facile diagnosis-specific tool to estimate survival for patients with brain metastases. J Clin Oncol. 2012;30(4):419-425. doi:10.1200/JCO.2011.38.0527
Examples
# Example 1: Good Prognosis
# KPS 90 (+2.0), Age 60 (+0.5), No extra mets (+1.0), 1 brain met (+0.5)
# Score = 4.0
gigpa_score(90, 60, 0, 1)
# Example 2: Poor Prognosis
# KPS 60 (0), Age 75 (0), Extra mets (+0), >1 brain met (0)
# Score = 0.0
gigpa_score(60, 75, 1, 3)
Gillmore Staging System for ATTR-CM
Description
Calculates the Gillmore Stage (I, II, or III) for patients with Transthyretin Amyloid Cardiomyopathy (ATTR-CM). This prognostic staging system applies to both wild-type and hereditary subtypes. It uses NT-proBNP (cutoff 3000 pg/mL) and eGFR (cutoff 45 mL/min/1.73m^2) to stratify patients into three risk groups.
Usage
gillmore_attr_cm_staging(nt_probnp_pg_ml, egfr_ml_min_1_73m2,
genotype = "wild-type")
Arguments
nt_probnp_pg_ml |
Numeric. N-terminal pro-B-type Natriuretic Peptide level in pg/mL. |
egfr_ml_min_1_73m2 |
Numeric. Estimated Glomerular Filtration Rate in mL/min/1.73m^2. |
genotype |
String. "wild-type" (default) or "hereditary"/"variant". Note: The staging cutoffs are universal, but original derivation included both populations. |
Value
A list containing:
Gillmore_Stage |
The calculated stage (1, 2, or 3). |
Median_Overall_Survival |
Estimated median survival based on the NAC derivation cohort. |
References
Gillmore JD, Dzonlic H,any T, et al. Transthyretin Amyloid Cardiomyopathy: Clinical Features and Outcome in a Large Cohort. Circulation. 2017;136(22):2119-2131. doi:10.1161/CIRCULATIONAHA.117.030458
Examples
# Example 1: Stage I (Low Risk)
# NT-proBNP 1000 (<3000), eGFR 60 (>=45)
gillmore_attr_cm_staging(1000, 60)
# Example 2: Stage III (High Risk)
# NT-proBNP 4000 (>3000), eGFR 30 (<45)
gillmore_attr_cm_staging(4000, 30)
# Example 3: Stage II (Intermediate)
# NT-proBNP 4000 (>3000), but eGFR 60 (>=45) -> One criteria met
gillmore_attr_cm_staging(4000, 60)
Genetically Inspired Prognostic Scoring System (GIPSS) for Primary Myelofibrosis
Description
Calculates the GIPSS score to estimate overall survival in patients with Primary Myelofibrosis (PMF). Unlike other scoring systems (e.g., DIPSS), GIPSS relies exclusively on genetic markers (karyotype and mutations) and one clinical variable (platelet count).
Usage
gipss_pmf_score(karyotype_category, platelet_count, asxl1_mutation,
srsf2_mutation, u2af1_q157_mutation)
Arguments
karyotype_category |
String. Cytogenetic risk category. "very_high_risk": Single/multiple abnormalities of -7, i(17q), inv(3)/3q21, 12p-/12p11.2, 11q-/11q23, or +21 (+2 points). "unfavorable": Any other abnormal karyotype (+1 point). "favorable": Normal karyotype or sole abnormalities of 13q-, 20q-, +9, chrm 1 translocation/duplication, or sex chromosome abnormality (0 points). |
platelet_count |
Numeric. Platelet count in 10^9/L. (< 100 x 10^9/L adds +1 point). |
asxl1_mutation |
Numeric (0 or 1). Presence of ASXL1 mutation. (1 = Yes, +1 point). |
srsf2_mutation |
Numeric (0 or 1). Presence of SRSF2 mutation. (1 = Yes, +1 point). |
u2af1_q157_mutation |
Numeric (0 or 1). Presence of U2AF1 Q157 mutation. (1 = Yes, +1 point). |
Value
A list containing:
GIPSS_Score |
The calculated score (Range 0-6). |
Risk_Category |
Classification (Low, Int-1, Int-2, High). |
Median_Overall_Survival |
Estimated median survival based on the Mayo Clinic validation cohort. |
References
Tefferi A, Guglielmelli P, Nicolosi M, et al. GIPSS: genetically inspired prognostic scoring system for primary myelofibrosis. Leukemia. 2018;32(7):1631-1642. doi:10.1038/s41375-018-0107-z
Examples
# Example 1: High Risk
# VHR Karyotype (+2), Platelets 150 (0), ASXL1 (+1)
# Score = 3
gipss_pmf_score("very_high_risk", 150, 1, 0, 0)
# Example 2: Low Risk
# Favorable Karyotype, Platelets 250, No mutations
# Score = 0
gipss_pmf_score("favorable", 250, 0, 0, 0)
Glasgow Alcoholic Hepatitis Score (GAHS)
Description
Calculates the Glasgow Alcoholic Hepatitis Score (GAHS) to predict the prognosis of patients with alcoholic hepatitis. The score ranges from 5 to 12, based on Age, White Blood Cell count, Urea, Prothrombin Time (INR), and Bilirubin. A score of 9 or higher indicates a poor prognosis and may guide the use of corticosteroids (specifically for patients with a discriminant function >= 32).
Usage
glasgow_alcoholic_hepatitis_score(age, wbc_count, urea, pt_inr, bilirubin,
bilirubin_units = "mg/dL", urea_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. (<50: 1 pt, >=50: 2 pts). |
wbc_count |
Numeric. White Blood Cell count in 10^9/L. (<15: 1 pt, >=15: 2 pts). |
urea |
Numeric. Blood Urea Nitrogen (BUN) or Urea. (<5 mmol/L: 1 pt, >=5 mmol/L: 2 pts). |
pt_inr |
Numeric. INR ratio. (<1.5: 1 pt, 1.5-2.0: 2 pts, >=2.0: 3 pts). |
bilirubin |
Numeric. Total Bilirubin level. (<125 umol/L: 1 pt, 125-250: 2 pts, >=250: 3 pts). |
bilirubin_units |
String. Units for bilirubin. "mg/dL" (default) or "umol/L". |
urea_units |
String. Units for urea input. "mg/dL" (default, assumed BUN) or "mmol/L". |
Value
A list containing:
GAHS_Score |
The calculated score (Range 5-12). |
Survival_28_Day |
Estimated 28-day survival percentage. |
Survival_84_Day |
Estimated 84-day survival percentage. |
References
Forrest EH, Evans CD, Stewart S, et al. Analysis of factors predictive of mortality in alcoholic hepatitis and derivation and validation of the Glasgow alcoholic hepatitis score. Gut. 2005;54(8):1174-1179. doi:10.1136/gut.2004.050781
Examples
# Example 1: High Risk (Score >= 9)
# Age 55 (2), WBC 18 (2), BUN 30 (~10mmol) (2), INR 2.2 (3), Bili 15 (~256umol) (3)
# Score = 2+2+2+3+3 = 12
glasgow_alcoholic_hepatitis_score(55, 18, 30, 2.2, 15)
# Example 2: Low Risk (Score < 9)
# Age 40 (1), WBC 10 (1), BUN 10 (~3.5mmol) (1), INR 1.2 (1), Bili 2 (~34umol) (1)
# Score = 5
glasgow_alcoholic_hepatitis_score(40, 10, 10, 1.2, 2)
Glasgow-Blatchford Bleeding Score (GBS)
Description
Calculates the Glasgow-Blatchford Score (GBS) to screen patients with upper gastrointestinal bleeding (UGIB). The score identifies low-risk patients who may be safely managed as outpatients. A score of 0 indicates low risk for needing medical intervention (transfusion, endoscopy, surgery).
Usage
glasgow_blatchford_score(bun, hemoglobin, systolic_bp, heart_rate, melena,
syncope, liver_disease, cardiac_failure, bun_units = "mg/dL")
Arguments
bun |
Numeric. Blood Urea Nitrogen level. 6.5-7.9 mg/dL: +2. 8.0-9.9 mg/dL: +3. 10.0-24.9 mg/dL: +4. >=25.0 mg/dL: +6. |
hemoglobin |
Numeric. Hemoglobin level in g/dL. 12.0-12.9 (Men): +1. 10.0-11.9 (Men/Women): +3. <10.0: +6. |
systolic_bp |
Numeric. Systolic Blood Pressure in mmHg. 100-109: +1. 90-99: +2. <90: +3. |
heart_rate |
Numeric. Heart Rate in bpm. (>= 100: +1 point). |
melena |
Numeric (0 or 1). Presence of melena. (1 = Yes, +1 point). |
syncope |
Numeric (0 or 1). Presentation with syncope. (1 = Yes, +2 points). |
liver_disease |
Numeric (0 or 1). History of hepatic disease. (1 = Yes, +2 points). |
cardiac_failure |
Numeric (0 or 1). History of cardiac failure. (1 = Yes, +2 points). |
bun_units |
String. Units for BUN input. "mg/dL" (default) or "mmol/L". |
Value
A list containing:
GBS_Score |
The calculated score (Range 0-23). |
Risk_Category |
Interpretation ("Low Risk" if 0, otherwise "High Risk"). |
References
Blatchford O, Murray WR, Blatchford M. A risk score to predict need for treatment for upper-gastrointestinal haemorrhage. Lancet. 2000;356(9238):1318-1321. doi:10.1016/S0140-6736(00)02816-6
Examples
# Example 1: Low Risk
# BUN 5, Hb 14, SBP 120, HR 70, No other factors
# Score = 0
glasgow_blatchford_score(5, 14, 120, 70, 0, 0, 0, 0)
# Example 2: High Risk
# BUN 30 (+6), Hb 9 (+6), Melena (+1)
# Score = 13
glasgow_blatchford_score(30, 9, 110, 90, 1, 0, 0, 0)
Glasgow Coma Scale (GCS)
Description
Calculates the Glasgow Coma Scale score, a neurological scale used to assess the state of a person's consciousness. The scale is composed of three tests: eye, verbal, and motor responses. The total score values range from 3 (deep coma) to 15 (fully awake).
Usage
glasgow_coma_scale(eye_response, verbal_response, motor_response)
Arguments
eye_response |
Numeric (1-4). 1: Does not open eyes. 2: Opens eyes in response to painful stimuli. 3: Opens eyes in response to voice. 4: Opens eyes spontaneously. |
verbal_response |
Numeric (1-5). 1: Makes no sounds. 2: Incomprehensible sounds. 3: Utters inappropriate words. 4: Confused, disoriented. 5: Oriented, converses normally. |
motor_response |
Numeric (1-6). 1: Makes no movements. 2: Extension to painful stimuli (decerebrate response). 3: Abnormal flexion to painful stimuli (decorticate response). 4: Flexion / Withdrawal to painful stimuli. 5: Localizes painful stimuli. 6: Obeys commands. |
Value
A list containing:
GCS_Score |
The calculated total GCS score (Range 3-15). |
Injury_Severity |
Classification (Mild 13-15, Moderate 9-12, Severe 3-8). |
Clinical_Action |
General management guidance based on the score (e.g., intubation for GCS <= 8). |
References
Teasdale G, Jennett B. Assessment of coma and impaired consciousness. A practical scale. Lancet. 1974;2(7872):81-84. doi:10.1016/s0140-6736(74)91639-0
Examples
# Example 1: Severe Injury
# Eye 1 (None), Verbal 2 (Sounds), Motor 4 (Withdrawal)
# Score = 7
glasgow_coma_scale(1, 2, 4)
# Example 2: Mild Injury
# Eye 4 (Spontaneous), Verbal 4 (Confused), Motor 6 (Obeys)
# Score = 14
glasgow_coma_scale(4, 4, 6)
Glasgow-Imrie Criteria for Acute Pancreatitis Severity
Description
Calculates the Glasgow-Imrie Score (Modified Glasgow Score) to assess the severity of acute pancreatitis within the first 48 hours of admission. The score utilizes the mnemonic PANCREAS to evaluate 8 prognostic factors. A score of 3 or greater indicates severe pancreatitis.
Usage
glasgow_imrie_pancreatitis_score(age, wbc, glucose, urea, pao2, albumin,
calcium, ldh, ast, alt,
glucose_units = "mmol/L",
urea_units = "mmol/L",
calcium_units = "mmol/L",
albumin_units = "g/L")
Arguments
age |
Numeric. Patient age in years. (> 55 years adds 1 point). |
wbc |
Numeric. White Blood Cell count (x 10^9/L). (> 15 adds 1 point). |
glucose |
Numeric. Serum glucose level. (> 10 mmol/L or 180 mg/dL adds 1 point). |
urea |
Numeric. Serum Urea level. (> 16 mmol/L or ~45 mg/dL BUN adds 1 point). |
pao2 |
Numeric. Arterial partial pressure of oxygen (mmHg). (< 60 mmHg adds 1 point). |
albumin |
Numeric. Serum albumin level. (< 32 g/L or 3.2 g/dL adds 1 point). |
calcium |
Numeric. Serum calcium level. (< 2.0 mmol/L or 8.0 mg/dL adds 1 point). |
ldh |
Numeric. Lactate dehydrogenase (U/L). (> 600 U/L adds 1 point as part of Enzyme criteria). |
ast |
Numeric. Aspartate aminotransferase (U/L). (> 200 U/L adds 1 point as part of Enzyme criteria). |
alt |
Numeric. Alanine aminotransferase (U/L). (> 200 U/L adds 1 point as part of Enzyme criteria). |
glucose_units |
String. "mmol/L" (default) or "mg/dL". |
urea_units |
String. "mmol/L" (default) or "mg/dL" (treats input as BUN). |
calcium_units |
String. "mmol/L" (default) or "mg/dL". |
albumin_units |
String. "g/L" (default) or "g/dL". |
Value
A list containing:
Glasgow_Imrie_Score |
The calculated score (Range 0-8). |
Severity_Assessment |
"Severe Pancreatitis" if Score >= 3, otherwise "Mild Pancreatitis". |
References
Blamey SL, Imrie CW, O'Neill J, Gilmour WH, Carter DC. Prognostic factors in acute pancreatitis. Gut. 1984;25(12):1340-1346. doi:10.1136/gut.25.12.1340
Examples
# Example 1: Severe Pancreatitis
# Age 60 (+1), WBC 18 (+1), Glucose 12 mmol (+1), LDH 700 (+1)
# Score = 4
glasgow_imrie_pancreatitis_score(60, 18, 12, 10, 70, 35, 2.2, 700, 100, 100)
# Example 2: Mild Pancreatitis
# 40yo, Normal labs except slightly low calcium
# Score = 1
glasgow_imrie_pancreatitis_score(40, 8, 5, 5, 90, 40, 1.9, 200, 30, 30)
Gleason Score and ISUP Grade Group for Prostate Cancer
Description
Calculates the Total Gleason Score and the corresponding International Society of Urological Pathology (ISUP) Prognostic Grade Group. The score is derived from the two most prevalent histologic patterns of the tumor, graded 1 to 5.
Usage
gleason_score_calculator(primary_grade, secondary_grade)
Arguments
primary_grade |
Numeric (1-5). The histologic pattern that is most prevalent in the biopsy sample. |
secondary_grade |
Numeric (1-5). The histologic pattern that is the second most prevalent in the biopsy sample. |
Value
A list containing:
Total_Gleason_Score |
The sum of the primary and secondary grades (Range 2-10). |
ISUP_Grade_Group |
The prognostic grade group (1-5) based on the 2014 ISUP consensus. |
Prognosis_Description |
Text description of the grade group. |
References
Epstein JI, Egevad L, Amin MB, et al. The 2014 International Society of Urological Pathology (ISUP) Consensus Conference on Gleason Grading of Prostatic Carcinoma. Am J Surg Pathol. 2016;40(2):244-252. doi:10.1097/PAS.0000000000000530
Examples
# Example 1: Grade Group 1
# Primary 3, Secondary 3
gleason_score_calculator(3, 3)
# Example 2: Grade Group 2 (3+4)
# Primary 3, Secondary 4
gleason_score_calculator(3, 4)
# Example 3: Grade Group 3 (4+3)
# Primary 4, Secondary 3
gleason_score_calculator(4, 3)
Glucose Infusion Rate (GIR) Calculator
Description
Calculates the Glucose Infusion Rate (GIR) in mg/kg/min. This calculation is essential in neonatal and pediatric care to ensure adequate glucose delivery for metabolic needs while preventing hypoglycemia or hyperglycemia.
Usage
glucose_infusion_rate(iv_rate_ml_hr, dextrose_conc_percent, weight_kg)
Arguments
iv_rate_ml_hr |
Numeric. The rate of intravenous fluid administration in mL per hour. |
dextrose_conc_percent |
Numeric. The concentration of dextrose in the fluid (e.g., 10 for D10W, 5 for D5W). |
weight_kg |
Numeric. The patient's weight in kilograms. |
Value
A list containing:
GIR_mg_kg_min |
The calculated glucose infusion rate. |
Interpretation |
General clinical context regarding standard maintenance ranges (typically 4-6 mg/kg/min for neonates). |
References
Adamkin DH. Nutrition management of the very low-birthweight infant. NeoReviews. 2006;7(12):e602-e614.
Examples
# Example 1: Normal Maintenance
# 3 kg neonate, D10W running at 9 mL/hr
# GIR = (9 * 10) / (6 * 3) = 90 / 18 = 5.0 mg/kg/min
glucose_infusion_rate(9, 10, 3)
# Example 2: High Requirement
# 4 kg infant, D12.5W running at 15 mL/hr
# GIR = (15 * 12.5) / (6 * 4) = 187.5 / 24 = 7.81 mg/kg/min
glucose_infusion_rate(15, 12.5, 4)
Glasgow Modified Alcohol Withdrawal Scale (GMAWS)
Description
Calculates the GMAWS score, a 5-item scale used to assess the severity of alcohol withdrawal syndrome. Each item is scored from 0 to 2. This scale is widely used in the UK and other regions to guide symptom-triggered benzodiazepine therapy.
Usage
gmaws_score(tremor, hallucinations, orientation, agitation, sweating)
Arguments
tremor |
Numeric (0-2). 0: No tremor. 1: Mild tremor. 2: Moderate/Severe tremor. |
hallucinations |
Numeric (0-2). 0: No hallucinations. 1: Mild hallucinations (distraction possible). 2: Severe hallucinations (continuous, no distraction possible). |
orientation |
Numeric (0-2). 0: Oriented to Time, Place, Person. 1: Oriented to 2 spheres. 2: Oriented to 1 or 0 spheres. |
agitation |
Numeric (0-2). 0: No agitation. 1: Mild agitation. 2: Moderate/Severe agitation (or aggression). |
sweating |
Numeric (0-2). 0: No sweating. 1: Moist palms / Mild sweat. 2: Drenching sweats. |
Value
A list containing:
GMAWS_Score |
The calculated total score (Range 0-10). |
Severity |
Clinical severity classification (Mild <4, Moderate 4-7, Severe >=8). |
Management_Guidance |
General treatment recommendation based on the score threshold of 4. |
References
McPherson A, et al. A new scale for the assessment of alcohol withdrawal symptoms. 2004. (Standard guideline reference).
Examples
# Example 1: Treatment Threshold Met
# Moderate tremor (2), Mild sweat (1), Agitation (1)
# Score = 4
gmaws_score(2, 0, 0, 1, 1)
# Example 2: Mild Withdrawal
# Mild tremor only
# Score = 1
gmaws_score(1, 0, 0, 0, 0)
GO-FAR Score for In-Hospital Cardiac Arrest Outcome
Description
Calculates the Good Outcome Following Attempted Resuscitation (GO-FAR) score to predict the likelihood of survival to discharge with good neurological outcome (CPC 1) after an in-hospital cardiac arrest (IHCA). The score uses pre-arrest variables available at admission or shortly before the event to stratify patients into risk categories.
Usage
go_far_cardiac_arrest_score(age, neurologically_intact_admission, major_trauma,
acute_stroke, metastatic_hematologic_cancer, septicemia,
medical_noncardiac_diagnosis, hepatic_insufficiency,
skilled_nursing_facility, hypotension_hypoperfusion,
renal_insufficiency_dialysis, respiratory_insufficiency,
pneumonia)
Arguments
age |
Numeric. Patient age in years. <70: 0 pts. 70-74: +2 pts. 75-79: +5 pts. 80-84: +6 pts. >=85: +11 pts. |
neurologically_intact_admission |
Numeric (0 or 1). Neurologically intact (CPC 1) or minimal deficits at admission. (1 = Yes, -15 pts). |
major_trauma |
Numeric (0 or 1). Major trauma during current admission. (1 = Yes, +10 pts). |
acute_stroke |
Numeric (0 or 1). Acute ischemic or hemorrhagic stroke during current admission. (1 = Yes, +8 pts). |
metastatic_hematologic_cancer |
Numeric (0 or 1). Metastatic or hematologic malignancy. (1 = Yes, +7 pts). |
septicemia |
Numeric (0 or 1). Septicemia. (1 = Yes, +7 pts). |
medical_noncardiac_diagnosis |
Numeric (0 or 1). Medical non-cardiac diagnosis on admission. (1 = Yes, +7 pts). |
hepatic_insufficiency |
Numeric (0 or 1). Hepatic insufficiency. (1 = Yes, +6 pts). |
skilled_nursing_facility |
Numeric (0 or 1). Admission from a skilled nursing facility (SNF). (1 = Yes, +6 pts). |
hypotension_hypoperfusion |
Numeric (0 or 1). Hypotension or hypoperfusion within 4 hours prior to arrest. (1 = Yes, +5 pts). |
renal_insufficiency_dialysis |
Numeric (0 or 1). Renal insufficiency or dialysis. (1 = Yes, +4 pts). |
respiratory_insufficiency |
Numeric (0 or 1). Respiratory insufficiency. (1 = Yes, +4 pts). |
pneumonia |
Numeric (0 or 1). Pneumonia. (1 = Yes, +1 pt). |
Value
A list containing:
GO_FAR_Score |
The calculated score. |
Probability_Neurologically_Intact_Survival |
Estimated probability of survival with good neurological outcome. |
Risk_Group |
Classification (Very Low, Low, Average, Above Average). |
References
Ebell MH, Jang W, Shen Y, Geocadin RG. Development and validation of the Good Outcome Following Attempted Resuscitation (GO-FAR) score to predict neurologically intact survival after in-hospital cardiopulmonary resuscitation. JAMA Intern Med. 2013;173(20):1872-1878. doi:10.1001/jamainternmed.2013.10037
Examples
# Example 1: Low Probability of Survival
# 85yo (+11), SNF (+6), Renal (+4), Neuro Intact (-15)
# Score = 11 + 6 + 4 - 15 = 6 (Average Probability? No wait, +6 is Average range -5 to 13)
# Let's check risk group: Score 6 -> Average Probability (3-15%)
go_far_cardiac_arrest_score(85, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0)
# Example 2: Very Low Probability
# 75yo (+5), Metastatic Cancer (+7), Sepsis (+7), Hypotension (+5), Not Neuro Intact (0)
# Score = 24
go_far_cardiac_arrest_score(75, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0)
GOLD Criteria for COPD (ABCD Assessment Tool)
Description
Calculates the GOLD Grade (1-4) based on airflow limitation and the GOLD Group (A, B, C, D) based on symptom burden and exacerbation risk. This combined assessment guides initial pharmacological treatment.
Usage
gold_copd_criteria(fev1_percent_predicted, exacerbations_last_year,
hospitalized_for_exacerbation, mmrc_score = NULL,
cat_score = NULL)
Arguments
fev1_percent_predicted |
Numeric. Post-bronchodilator FEV1 percent predicted. Used for spirometric grading (GOLD 1-4). |
exacerbations_last_year |
Numeric. Number of moderate exacerbations in the past year (requiring antibiotics and/or oral steroids). |
hospitalized_for_exacerbation |
Numeric (0 or 1). Has the patient had >= 1 exacerbation leading to hospitalization? (1 = Yes). |
mmrc_score |
Numeric (0-4) (Optional). Modified Medical Research Council Dyspnea Scale. |
cat_score |
Numeric (0-40) (Optional). COPD Assessment Test score. |
Details
Risk Assessment (Y-Axis): Low Risk: 0 or 1 moderate exacerbation (not leading to admission). High Risk: >= 2 moderate exacerbations OR >= 1 leading to admission.
Symptom Assessment (X-Axis): Low Symptoms: mMRC 0-1 OR CAT < 10. High Symptoms: mMRC >= 2 OR CAT >= 10.
Value
A list containing:
GOLD_Spirometry_Grade |
Classification of airflow limitation (GOLD 1-4). |
GOLD_Group |
ABCD grouping based on symptoms and risk. |
Treatment_Recommendation |
Initial pharmacological management guidance. |
References
Global Initiative for Chronic Obstructive Lung Disease (GOLD). Global Strategy for the Diagnosis, Management, and Prevention of Chronic Obstructive Lung Disease. 2020 Report.
Examples
# Example 1: Group B (High Symptom, Low Risk)
# FEV1 60% (GOLD 2), 0 Exacerbations, mMRC 2
gold_copd_criteria(60, 0, 0, mmrc_score = 2)
# Example 2: Group D (High Symptom, High Risk)
# FEV1 35% (GOLD 3), 2 Exacerbations, CAT 18
gold_copd_criteria(35, 2, 0, cat_score = 18)
Glasgow Prognostic Score (GPS) for Cancer Outcomes
Description
Calculates the Glasgow Prognostic Score (GPS) to predict survival outcomes in patients with advanced cancer. This score uses C-Reactive Protein (CRP) and Albumin levels to reflect the systemic inflammatory response and nutritional status, which are strong independent prognostic factors in various malignancies.
Usage
gps_cancer_score(crp_mg_l, albumin_g_l)
Arguments
crp_mg_l |
Numeric. Serum C-Reactive Protein level in mg/L. (> 10 mg/L indicates elevated inflammation). |
albumin_g_l |
Numeric. Serum Albumin level in g/L. (< 35 g/L indicates hypoalbuminemia). |
Value
A list containing:
GPS_Score |
The calculated score (0, 1, or 2). |
Prognosis |
Risk classification (Good, Intermediate, Poor). |
References
Forrest LM, McMillan DC, McArdle CS, et al. Evaluation of cumulative prognostic scores based on the systemic inflammatory response in patients with inoperable non-small-cell lung cancer. Br J Cancer. 2003;89(6):1028-1030. doi:10.1038/sj.bjc.6601242
Examples
# Example 1: Poor Prognosis
# CRP 20 (>10), Albumin 30 (<35)
# Score = 2
gps_cancer_score(20, 30)
# Example 2: Good Prognosis
# CRP 5 (<10), Albumin 40 (>35)
# Score = 0
gps_cancer_score(5, 40)
GRACE ACS Risk and Mortality Calculator
Description
Calculates the GRACE (Global Registry of Acute Coronary Events) Risk Score for predicting in-hospital mortality in patients with Acute Coronary Syndrome (ACS). The score stratifies patients based on age, heart rate, systolic blood pressure, creatinine, Killip class, cardiac arrest at admission, ST-segment deviation, and elevated cardiac enzymes.
Usage
grace_acs_risk(age, heart_rate, systolic_bp, creatinine, killip_class,
cardiac_arrest_admission, st_segment_deviation,
elevated_cardiac_enzymes, creatinine_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. |
heart_rate |
Numeric. Heart rate in beats per minute. |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
creatinine |
Numeric. Serum creatinine level. |
killip_class |
Numeric (1-4). Killip Class classification for heart failure severity. 1: No signs of congestive heart failure. 2: Rales, S3 gallop, or JVD. 3: Frank pulmonary edema. 4: Cardiogenic shock. |
cardiac_arrest_admission |
Numeric (0 or 1). Cardiac arrest occurred at admission. (1 = Yes). |
st_segment_deviation |
Numeric (0 or 1). ST-segment deviation on EKG. (1 = Yes). |
elevated_cardiac_enzymes |
Numeric (0 or 1). Elevated cardiac enzymes/markers (e.g., Troponin). (1 = Yes). |
creatinine_units |
String. Units for creatinine input. Options: "mg/dL" (default) or "umol/L". |
Value
A list containing:
GRACE_Score |
The calculated total risk score (Range 0-372). |
In_Hospital_Mortality_Risk |
Estimated percentage probability of in-hospital death. |
Risk_Category |
Classification (Low, Intermediate, High). |
References
Granger CB, Goldberg RJ, Dabbous O, et al. Predictors of hospital mortality in the global registry of acute coronary events. Arch Intern Med. 2003;163(19):2345-2353. doi:10.1001/archinte.163.19.2345
Examples
# Example 1: High Risk
# 75yo, HR 110, SBP 100, Cr 2.0, Killip 3, ST Dev Yes, Enzymes Yes
# Score calculation depends on variable bins.
grace_acs_risk(75, 110, 100, 2.0, 3, 0, 1, 1)
# Example 2: Low Risk
# 50yo, HR 70, SBP 130, Cr 0.9, Killip 1, No arrest/ST dev/Enzymes
grace_acs_risk(50, 70, 130, 0.9, 1, 0, 0, 0)
Grogan (Mayo Clinic) Staging System for ATTR-CM
Description
Calculates the Grogan Stage for patients with wild-type Transthyretin Amyloid Cardiomyopathy (ATTRwt-CM). The staging system predicts overall survival based on two biomarkers: NT-proBNP (threshold 3000 pg/mL) and Troponin T (threshold 0.05 ng/mL) or Troponin I (threshold 0.1 ng/mL).
Usage
grogan_attr_cm_staging(nt_probnp_pg_ml, troponin_t_ng_ml = NULL,
troponin_i_ng_ml = NULL)
Arguments
nt_probnp_pg_ml |
Numeric. N-terminal pro-B-type Natriuretic Peptide level in pg/mL. (Threshold >= 3000 adds 1 point). |
troponin_t_ng_ml |
Numeric (Optional). Troponin T level in ng/mL. (Threshold >= 0.05 adds 1 point). Provide either TnT or TnI. |
troponin_i_ng_ml |
Numeric (Optional). Troponin I level in ng/mL. (Threshold >= 0.1 adds 1 point). Provide either TnT or TnI. |
Value
A list containing:
Grogan_Stage |
The calculated stage (1, 2, or 3). |
Median_Overall_Survival |
Estimated median survival based on the Mayo Clinic derivation cohort. |
References
Grogan M, Scott CG, Kyle RA, et al. Natural History of Wild-Type Transthyretin Cardiac Amyloidosis and Risk Stratification Using a Novel Staging System. J Am Coll Cardiol. 2016;68(10):1014-1020. doi:10.1016/j.jacc.2016.06.033
Examples
# Example 1: Stage 1 (Low Risk)
# NT-proBNP 1500 (<3000), TnT 0.02 (<0.05)
grogan_attr_cm_staging(1500, troponin_t_ng_ml = 0.02)
# Example 2: Stage 3 (High Risk)
# NT-proBNP 5000 (>3000), TnI 0.2 (>0.1)
grogan_attr_cm_staging(5000, troponin_i_ng_ml = 0.2)
Gupta Perioperative Risk for Myocardial Infarction or Cardiac Arrest (MICA)
Description
Calculates the percentage risk of perioperative Myocardial Infarction (MI) or Cardiac Arrest (MICA) within 30 days of surgery. This model was derived from the NSQIP database and provides a site-specific risk assessment based on five preoperative predictors.
Usage
gupta_mica_risk(age, creatinine_mg_dl, asa_class, functional_status,
procedure_type)
Arguments
age |
Numeric. Patient age in years. |
creatinine_mg_dl |
Numeric. Preoperative serum creatinine in mg/dL. |
asa_class |
Numeric (1-5). American Society of Anesthesiologists Physical Status Classification. 1: Normal healthy patient. 2: Mild systemic disease. 3: Severe systemic disease. 4: Severe systemic disease that is a constant threat to life. 5: Moribund. |
functional_status |
String. Preoperative functional status. Options: "independent", "partially_dependent", "totally_dependent". |
procedure_type |
String. Surgical site/category. Valid options include: "anorectal", "aortic", "bariatric", "brain", "breast", "cardiac", "ent", "foregut_hepatopancreatobiliary", "gallbladder_appendix_adrenal_spleen", "hernia_ventral_inguinal", "intestinal", "neck_thyroid_parathyroid", "obgyn", "ortho_non_spine", "spine", "thoracic_non_cardiac", "urology", "vascular_non_aortic", "vein". |
Value
A list containing:
MICA_Risk_Percent |
The estimated percentage risk of perioperative MI or Cardiac Arrest. |
Inputs |
A record of the parameters used for the calculation. |
References
Gupta PK, Gupta H, Sundaram A, et al. Development and validation of a risk calculator for prediction of cardiac risk after surgery. Circulation. 2011;124(4):381-387. doi:10.1161/CIRCULATIONAHA.110.015701
Examples
# Example 1: High Risk (Aortic Surgery)
# 75yo, Cr 1.6, ASA 4, Partially Dependent
gupta_mica_risk(75, 1.6, 4, "partially_dependent", "aortic")
# Example 2: Low Risk (Breast Surgery)
# 45yo, Cr 0.8, ASA 1, Independent
gupta_mica_risk(45, 0.8, 1, "independent", "breast")
Gupta Postoperative Pneumonia Risk
Description
Calculates the percentage risk of developing postoperative pneumonia based on the Gupta et al. (2013) model derived from the NSQIP database. This calculator is designed for adult patients undergoing non-cardiac and cardiac surgeries.
Usage
gupta_pneumonia_risk(age, copd, functional_status, asa_class, sepsis_status,
smoker, procedure_type)
Arguments
age |
Numeric. Patient age in years. |
copd |
Numeric (0 or 1). History of COPD. (1 = Yes). |
functional_status |
String. Preoperative functional status. Options: "independent", "partially_dependent", "totally_dependent". |
asa_class |
Numeric. ASA Physical Status Classification (1-5). |
sepsis_status |
String. Preoperative sepsis category. Options: "none", "sirs" (Systemic Inflammatory Response Syndrome), "sepsis", "septic_shock". |
smoker |
Numeric (0 or 1). Current smoker (within 1 year). (1 = Yes). |
procedure_type |
String. Surgical procedure category. Valid options include: "anorectal", "aortic", "bariatric", "brain", "breast", "cardiac", "ent", "foregut_hepatopancreatobiliary", "gallbladder_appendix_adrenal_spleen", "hernia_ventral_inguinal", "intestinal", "neck_thyroid_parathyroid", "obgyn", "orthopedic", "other_abdominal", "peripheral_vascular", "skin", "spine", "thoracic_non_cardiac", "urology", "vein". |
Value
A list containing:
Pneumonia_Risk_Percent |
The estimated probability of postoperative pneumonia. |
References
Gupta H, Gupta PK, Schuller D, et al. Development and validation of a risk calculator for predicting postoperative pneumonia. Mayo Clin Proc. 2013;88(11):1241-1249. doi:10.1016/j.mayocp.2013.06.027
Examples
# Example 1: High Risk (Aortic Surgery)
# 75yo, COPD, Totally Dependent, ASA 4, Sepsis, Smoker
gupta_pneumonia_risk(75, 1, "totally_dependent", 4, "sepsis", 1, "aortic")
# Example 2: Low Risk (Hernia Repair)
# 40yo, Independent, ASA 1, No Sepsis/Smoke
gupta_pneumonia_risk(40, 0, "independent", 1, "none", 0, "hernia_ventral_inguinal")
Gupta Postoperative Respiratory Failure Risk
Description
Calculates the percentage risk of postoperative respiratory failure (mechanical ventilation > 48h or unplanned reintubation) based on the Gupta et al. (2011) model. This calculator uses five preoperative predictors: procedure type, ASA status, functional dependence, sepsis, and emergency status.
Usage
gupta_respiratory_failure_risk(procedure_type, asa_class, functional_status,
emergency_case, sepsis_status)
Arguments
procedure_type |
String. Surgical procedure category. Valid options include: "anorectal", "aortic", "bariatric", "brain", "breast", "cardiac", "ent", "foregut_hepatopancreatobiliary", "gallbladder_appendix_adrenal_spleen", "hernia_ventral_inguinal", "intestinal", "neck_thyroid_parathyroid", "obgyn", "orthopedic", "other_abdominal", "peripheral_vascular", "skin", "spine", "thoracic_non_cardiac", "urology", "vein". |
asa_class |
Numeric. ASA Physical Status Classification (1-5). |
functional_status |
String. Preoperative functional status. Options: "independent", "partially_dependent", "totally_dependent". |
emergency_case |
Numeric (0 or 1). Is the surgery an emergency? (1 = Yes). |
sepsis_status |
String. Preoperative sepsis category. Options: "none", "sirs", "sepsis", "septic_shock". |
Value
A list containing:
Respiratory_Failure_Risk_Percent |
The estimated probability of postoperative respiratory failure. |
References
Gupta H, Gupta PK, Fang X, et al. Development and validation of a risk calculator predicting postoperative respiratory failure. Chest. 2011;140(5):1207-1215. doi:10.1378/chest.11-0466
Examples
# Example 1: High Risk (Emergency Aortic)
# Aortic, ASA 4, Dependent, Sepsis, Emergency
gupta_respiratory_failure_risk("aortic", 4, "totally_dependent", 1, "sepsis")
# Example 2: Low Risk (Elective Hernia)
# Hernia, ASA 2, Independent, No Sepsis, Elective
gupta_respiratory_failure_risk("hernia_ventral_inguinal", 2, "independent", 0, "none")
GWTG-HF Risk Score for In-Hospital Mortality
Description
Calculates the Get With The Guidelines-Heart Failure (GWTG-HF) risk score to predict in-hospital all-cause mortality in patients hospitalized with heart failure. The score uses admission vitals (SBP, HR), labs (BUN, Sodium), age, COPD history, and race.
Usage
gwtg_hf_risk_score(age, systolic_bp, bun, heart_rate, sodium, copd,
race_black = 0, bun_units = "mg/dL", sodium_units = "mEq/L")
Arguments
age |
Numeric. Patient age in years. |
systolic_bp |
Numeric. Admission Systolic Blood Pressure (mmHg). |
bun |
Numeric. Admission Blood Urea Nitrogen level. |
heart_rate |
Numeric. Admission Heart Rate (bpm). |
sodium |
Numeric. Admission Serum Sodium level. |
copd |
Numeric (0 or 1). History of Chronic Obstructive Pulmonary Disease. (1 = Yes). |
race_black |
Numeric (0 or 1). Is the patient Black/African American? (1 = Yes, 0 = No). Note: Non-Black race adds points in this model. |
bun_units |
String. Units for BUN input. "mg/dL" (default) or "mmol/L". |
sodium_units |
String. Units for Sodium input. "mEq/L" (default) or "mmol/L". |
Value
A list containing:
GWTG_HF_Score |
The calculated risk score (Range 0-100+). |
Est_In_Hospital_Mortality |
Estimated probability of in-hospital mortality. |
References
Peterson PN, Rumsfeld JS, Liang L, et al. A validated risk score for in-hospital mortality in patients with heart failure from the Get With the Guidelines Program. Circ Cardiovasc Qual Outcomes. 2010;3(1):25-32. doi:10.1161/CIRCOUTCOMES.109.854877
Examples
# Example 1: High Risk
# 85yo, SBP 100, BUN 50, HR 100, Na 130, COPD, White
gwtg_hf_risk_score(85, 100, 50, 100, 130, 1, 0)
# Example 2: Low Risk
# 50yo, SBP 140, BUN 15, HR 70, Na 140, No COPD, Black
gwtg_hf_risk_score(50, 140, 15, 70, 140, 0, 1)
H2FPEF Score for HFpEF Probability
Description
Calculates the H2FPEF score to estimate the probability of Heart Failure with Preserved Ejection Fraction (HFpEF) in patients with unexplained dyspnea. The score uses six clinical and echocardiographic variables: Heavy (BMI > 30), Hypertensive (>= 2 meds), Atrial Fibrillation, Pulmonary Hypertension, Elder (> 60), and Filling Pressure (E/e' > 9).
Usage
h2fpef_score(bmi, num_hypertensive_meds, atrial_fibrillation,
pulmonary_hypertension_gt_35, age_gt_60, e_e_prime_gt_9)
Arguments
bmi |
Numeric. Body Mass Index (kg/m^2). (>30 adds 2 points). |
num_hypertensive_meds |
Numeric. Number of antihypertensive medications currently prescribed. (>= 2 adds 1 point). |
atrial_fibrillation |
Numeric (0 or 1). History or presence of Paroxysmal or Persistent Atrial Fibrillation. (1 = Yes, +3 points). |
pulmonary_hypertension_gt_35 |
Numeric (0 or 1). Pulmonary Artery Systolic Pressure > 35 mmHg on echocardiogram. (1 = Yes, +1 point). |
age_gt_60 |
Numeric (0 or 1). Age > 60 years. (1 = Yes, +1 point). |
e_e_prime_gt_9 |
Numeric (0 or 1). E/e' ratio > 9 on echocardiogram. (1 = Yes, +1 point). |
Value
A list containing:
H2FPEF_Score |
The calculated score (Range 0-9). |
HFpEF_Probability |
Estimated probability of HFpEF diagnosis. |
References
Reddy YNV, Carter RE, Obokata M, et al. A Simple, Evidence-Based Scoring System for Patients With Unexplained Dyspnea. Circulation. 2018;138(8):861-870. doi:10.1161/CIRCULATIONAHA.118.034613
Examples
# Example 1: High Probability
# BMI 35 (+2), 3 HTN meds (+1), AFib (+3), Age 70 (+1), E/e' 12 (+1), PASP 40 (+1)
# Score = 9
h2fpef_score(35, 3, 1, 1, 1, 1)
# Example 2: Low Probability
# BMI 25 (0), 0 HTN meds (0), No AFib (0), Age 40 (0), E/e' 8 (0), PASP 25 (0)
# Score = 0
h2fpef_score(25, 0, 0, 0, 0, 0)
HACKS Impairment Index (HII)
Description
Calculates the HACKS Impairment Index score to screen for frailty and predict the risk of institutionalization and mortality in older adults. The acronym HACKS stands for: Hearing loss, ADL/IADL impairment, Cognitive impairment, K(C)omorbidity, and Slow gait (though specific items have evolved in validation studies to the 6 used here: Gait Speed, SPPB/Physical Performance, Cognition, Incontinence, ADL, IADL).
Usage
hacks_impairment_index(gait_speed_lt_0_8, physical_performance_lt_10,
mmse_lt_26, incontinence, adl_impairment,
iadl_impairment)
Arguments
gait_speed_lt_0_8 |
Numeric (0 or 1). Gait speed < 0.8 m/s. (1 = Yes, +1 point). |
physical_performance_lt_10 |
Numeric (0 or 1). Short Physical Performance Battery (SPPB) score < 10. (1 = Yes, +1 point). |
mmse_lt_26 |
Numeric (0 or 1). MMSE score < 26. (1 = Yes, +1 point). |
incontinence |
Numeric (0 or 1). Presence of urinary incontinence. (1 = Yes, +1 point). |
adl_impairment |
Numeric (0 or 1). Impairment in at least one Activity of Daily Living (ADL). (1 = Yes, +1 point). |
iadl_impairment |
Numeric (0 or 1). Impairment in at least one Instrumental Activity of Daily Living (IADL). (1 = Yes, +1 point). |
Value
A list containing:
HII_Score |
The calculated total score (Range 0-6). |
Impairment_Level |
Classification (No, Mild, Severe Impairment). |
Institutionalization_Risk |
Estimated risk category. |
References
Jankovic D, et al. The HACKS impairment index: a simple screening tool for frailty and adverse outcomes in older adults. (Contextual reference based on tool description).
Examples
# Example 1: Severe Impairment
# Slow gait (+1), SPPB<10 (+1), MMSE<26 (+1), ADL (+1)
# Score = 4
hacks_impairment_index(1, 1, 1, 0, 1, 0)
# Example 2: No Impairment
# All normal
hacks_impairment_index(0, 0, 0, 0, 0, 0)
HACOR Score for NIV Failure
Description
Calculates the HACOR score to predict the likelihood of Non-Invasive Ventilation (NIV) failure in patients with hypoxemic respiratory failure. The score is based on Heart rate, Acidosis (pH), Consciousness (GCS), Oxygenation (PaO2/FiO2), and Respiratory rate. A score > 5 assessed 1 hour after initiation suggests a high risk of failure.
Usage
hacor_score(heart_rate, ph, gcs, pao2_fio2_ratio, respiratory_rate)
Arguments
heart_rate |
Numeric. Heart rate in beats per minute. (>= 120 adds 1 point). |
ph |
Numeric. Arterial pH. (<7.25: 4 pts; 7.25-7.29: 3 pts; 7.30-7.34: 2 pts). |
gcs |
Numeric. Glasgow Coma Scale score. (<15 adds 10 points). |
pao2_fio2_ratio |
Numeric. PaO2/FiO2 ratio. (<=100: 6 pts; 101-125: 5 pts; 126-150: 4 pts; 151-175: 3 pts; 176-200: 2 pts). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. (>45: 4 pts; 41-45: 3 pts; 36-40: 2 pts; 31-35: 1 pt). |
Value
A list containing:
HACOR_Score |
The calculated score (Range 0-25). |
NIV_Failure_Probability |
Estimated probability of NIV failure. |
Recommendation |
Clinical suggestion regarding intubation. |
References
Duan J, Han X, Bai L, et al. Assessment of heart rate, acidosis, consciousness, oxygenation, and respiratory rate to predict noninvasive ventilation failure in hypoxemic patients. Intensive Care Med. 2017;43(2):192-199. doi:10.1007/s00134-016-4601-3
Examples
# Example 1: High Risk
# HR 130 (+1), pH 7.20 (+4), GCS 14 (+10), PF 120 (+5), RR 35 (+1)
# Score = 21
hacor_score(130, 7.20, 14, 120, 35)
# Example 2: Low Risk
# HR 90 (0), pH 7.40 (0), GCS 15 (0), PF 250 (0), RR 20 (0)
# Score = 0
hacor_score(90, 7.40, 15, 250, 20)
Hamilton Anxiety Rating Scale (HAM-A)
Description
Calculates the HAM-A score, a 14-item clinician-administered rating scale used to assess the severity of anxiety symptoms. Each item is scored on a scale of 0 (Not present) to 4 (Very severe). The total score (0-56) indicates the overall level of anxiety.
Usage
hamilton_anxiety_scale(anxious_mood, tension, fears, insomnia, intellectual,
depressed_mood, somatic_muscular, somatic_sensory,
cardiovascular, respiratory, gastrointestinal,
genitourinary, autonomic, behavior_at_interview)
Arguments
anxious_mood |
Numeric (0-4). Worries, anticipation of the worst, fearful anticipation, irritability. |
tension |
Numeric (0-4). Feelings of tension, fatigability, startle response, moved to tears easily, trembling, feelings of restlessness, inability to relax. |
fears |
Numeric (0-4). Of dark, of strangers, of being left alone, of animals, of traffic, of crowds. |
insomnia |
Numeric (0-4). Difficulty in falling asleep, broken sleep, unsatisfying sleep and fatigue on waking, dreams, nightmares, night terrors. |
intellectual |
Numeric (0-4). Difficulty in concentration, poor memory. |
depressed_mood |
Numeric (0-4). Loss of interest, lack of pleasure in hobbies, depression, early waking, diurnal swing. |
somatic_muscular |
Numeric (0-4). Pains and aches, twitching, stiffness, myoclonic jerks, grinding of teeth, unsteady voice, increased muscular tone. |
somatic_sensory |
Numeric (0-4). Tinnitus, blurring of vision, hot and cold flushes, feelings of weakness, picking sensation. |
cardiovascular |
Numeric (0-4). Tachycardia, palpitations, pain in chest, throbbing of vessels, fainting feelings, missing beat. |
respiratory |
Numeric (0-4). Pressure or constriction in chest, choking feelings, sighing, dyspnea. |
gastrointestinal |
Numeric (0-4). Difficulty in swallowing, wind abdominal pain, burning sensations, abdominal fullness, nausea, vomiting, borborygmi, looseness of bowels, loss of weight, constipation. |
genitourinary |
Numeric (0-4). Frequency of micturition, urgency of micturition, amenorrhea, menorrhagia, development of frigidity, premature ejaculation, loss of libido, impotence. |
autonomic |
Numeric (0-4). Dry mouth, flushing, pallor, tendency to sweat, giddiness, tension headache, raising of hair. |
behavior_at_interview |
Numeric (0-4). Fidgeting, restlessness or pacing, tremor of hands, furrowed brow, strained face, sighing or rapid respiration, facial pallor, swallowing, etc. |
Details
Scoring Key: 0 = Not present 1 = Mild 2 = Moderate 3 = Severe 4 = Very severe
Value
A list containing:
HAM_A_Score |
The calculated total score (Range 0-56). |
Severity_Category |
Interpretation (Mild <=17, Mild-Moderate 18-24, Mod-Severe 25-30, Severe >30). |
References
Hamilton M. The assessment of anxiety states by rating. Br J Med Psychol. 1959;32(1):50-55. doi:10.1111/j.2044-8341.1959.tb00467.x
Examples
# Example 1: Severe Anxiety
# All items scored 3 (Severe)
hamilton_anxiety_scale(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3)
# Example 2: Mild Anxiety
# Most items 0 or 1
hamilton_anxiety_scale(1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0)
Hamilton Depression Rating Scale (HAM-D)
Description
Calculates the HAM-D score (17-item version), the gold standard clinician-administered assessment for determining the severity of depression. It evaluates mood, vegetative functions, cognitive symptoms, and somatic complaints.
Usage
hamilton_depression_scale(depressed_mood, guilt, suicide, insomnia_early,
insomnia_middle, insomnia_late, work_activities,
retardation, agitation, anxiety_psychic,
anxiety_somatic, somatic_gi, somatic_general,
genital_symptoms, hypochondriasis, weight_loss,
insight)
Arguments
depressed_mood |
Numeric (0-4). Sadness, hopeless, helpless, worthless. |
guilt |
Numeric (0-4). Self-reproach, feeling that they have let people down. |
suicide |
Numeric (0-4). Thoughts that life is not worth living, suicidal ideas or attempts. |
insomnia_early |
Numeric (0-2). Difficulty falling asleep. |
insomnia_middle |
Numeric (0-2). Waking during the night. |
insomnia_late |
Numeric (0-2). Waking in early hours of the morning. |
work_activities |
Numeric (0-4). Thoughts/feelings of incapacity, loss of interest, decrease in actual time spent. |
retardation |
Numeric (0-4). Slowness of thought and speech, impaired ability to concentrate, decreased motor activity. |
agitation |
Numeric (0-4). Fidgeting, playing with hands/hair, moving about. |
anxiety_psychic |
Numeric (0-4). Subjective tension and irritability, worrying. |
anxiety_somatic |
Numeric (0-4). Physiological concomitants of anxiety (e.g., GI, CV, respiratory). |
somatic_gi |
Numeric (0-2). Loss of appetite, heavy feeling in abdomen, constipation. |
somatic_general |
Numeric (0-2). Heaviness in limbs, back, or head; loss of energy. |
genital_symptoms |
Numeric (0-2). Loss of libido, menstrual disturbances. |
hypochondriasis |
Numeric (0-4). Absorption in self, bodily concerns. |
weight_loss |
Numeric (0-2). Weight loss associated with present illness. |
insight |
Numeric (0-2). Acknowledgment of being depressed/ill. |
Details
The standard 17-item scale is scored as follows:
0-7: Normal
8-13: Mild Depression
14-18: Moderate Depression
19-22: Severe Depression
>=23: Very Severe Depression
Value
A list containing:
HAM_D_Score |
The calculated total score (Range 0-52). |
Severity_Category |
Clinical interpretation of the score. |
References
Hamilton M. A rating scale for depression. J Neurol Neurosurg Psychiatry. 1960;23:56-62. doi:10.1136/jnnp.23.1.56
Examples
# Example 1: Severe Depression
# High scores across mood, guilt, suicide, and somatic symptoms
hamilton_depression_scale(3, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0)
# Example 2: Normal/Remission
# Minimal symptoms
hamilton_depression_scale(0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)
Harmless Acute Pancreatitis Score (HAPS)
Description
Calculates the Harmless Acute Pancreatitis Score (HAPS). This tool identifies patients with acute pancreatitis who are likely to have a non-severe clinical course (defined as no necrosis and no organ failure). Identification requires the absence of rebound tenderness, normal hematocrit levels, and normal serum creatinine.
Usage
haps_score(rebound_tenderness, hematocrit, creatinine, sex,
creatinine_units = "mg/dL")
Arguments
rebound_tenderness |
Numeric (0 or 1). Presence of rebound tenderness and/or guarding. (1 = Yes, 0 = No). |
hematocrit |
Numeric. Hematocrit percentage. (Normal considered <= 43.0 for men, <= 39.6 for women). |
creatinine |
Numeric. Serum creatinine level. (Normal considered < 2.0 mg/dL). |
sex |
String. Patient sex ("Male" or "Female"). Used for Hematocrit threshold. |
creatinine_units |
String. Units for creatinine. "mg/dL" (default) or "micromol/L". |
Value
A list containing:
HAPS_Result |
Interpretation: "Harmless Acute Pancreatitis Likely" (if all criteria are normal) or "Not Classified as Harmless". |
Probability_Harmless_Course |
Positive Predictive Value for a harmless course (~98% if HAPS criteria met). |
Criteria_Failed |
List of specific parameters that were abnormal, preventing the "Harmless" classification. |
References
Lankisch PG, Weber-Dany B, Hebel K, Maisonneuve P, Lowenfels AB. The harmless acute pancreatitis score: a clinical algorithm for rapid initial stratification of nonsevere disease. Clin Gastroenterol Hepatol. 2009;7(6):702-705. doi:10.1016/j.cgh.2009.02.020
Examples
# Example 1: Harmless Course Likely
# No rebound, Hct 40 (Male), Cr 1.0
haps_score(0, 40, 1.0, "male")
# Example 2: Risk of Severe Course
# No rebound, but Hct 45 (Male -> Abnormal), Cr 1.0
haps_score(0, 45, 1.0, "male")
HARK Screen for Intimate Partner Violence
Description
Calculates the HARK score, a brief 4-item screening tool designed to identify intimate partner violence (IPV) in clinical settings. The acronym stands for Humiliation, Afraid, Rape, and Kick. A score of 1 or greater indicates a positive screen.
Usage
hark_screen(humiliation, afraid, rape, kick)
Arguments
humiliation |
Numeric (0 or 1). Within the last year, have you been humiliated or emotionally abused in other ways by your partner or your ex-partner? (1 = Yes). |
afraid |
Numeric (0 or 1). Within the last year, have you been afraid of your partner or ex-partner? (1 = Yes). |
rape |
Numeric (0 or 1). Within the last year, have you been raped or forced to have any kind of sexual activity by your partner or ex-partner? (1 = Yes). |
kick |
Numeric (0 or 1). Within the last year, have you been kicked, hit, slapped, or otherwise physically hurt by your partner or ex-partner? (1 = Yes). |
Value
A list containing:
HARK_Score |
The calculated total score (Range 0-4). |
Screen_Result |
"Positive Screen" (Score >= 1) or "Negative Screen". |
Recommendation |
Clinical guidance based on the result. |
References
Sohal H, Eldridge S, Feder G. The sensitivity and specificity of four questions (HARK) to identify intimate partner violence: a diagnostic accuracy study in general practice. BMC Fam Pract. 2007;8:49. doi:10.1186/1471-2296-8-49
Examples
# Example 1: Positive Screen (Humiliation only)
# Score = 1
hark_screen(1, 0, 0, 0)
# Example 2: Positive Screen (Physical and Sexual violence)
# Score = 2
hark_screen(0, 0, 1, 1)
# Example 3: Negative Screen
# Score = 0
hark_screen(0, 0, 0, 0)
Harvey-Bradshaw Index (HBI) for Crohn's Disease
Description
Calculates the Harvey-Bradshaw Index (HBI), a simpler alternative to the Crohn's Disease Activity Index (CDAI) for assessing disease activity. It relies on five clinical parameters collected over the previous day (or short period) rather than the 7-day diary required by the CDAI.
Usage
harvey_bradshaw_index(general_wellbeing, abdominal_pain, liquid_stools_daily,
abdominal_mass, complications_count)
Arguments
general_wellbeing |
Numeric (0-4). Patient's general well-being. 0: Very well. 1: Slightly below par. 2: Poor. 3: Very poor. 4: Terrible. |
abdominal_pain |
Numeric (0-3). Abdominal pain. 0: None. 1: Mild. 2: Moderate. 3: Severe. |
liquid_stools_daily |
Numeric. Number of liquid or soft stools per day. (1 point per stool). |
abdominal_mass |
Numeric (0-3). Abdominal mass. 0: None. 1: Dubious. 2: Definite. 3: Definite and tender. |
complications_count |
Numeric. Count of specific complications (1 point for each): Arthralgia, Uveitis, Erythema nodosum, Aphthous ulcers, Pyoderma gangrenosum, Anal fissure, New fistula, Abscess. |
Value
A list containing:
HBI_Score |
The calculated total score. |
Disease_Activity |
Classification (Remission < 5, Mild 5-7, Moderate 8-16, Severe > 16). |
References
Harvey RF, Bradshaw JM. A simple index of Crohn's-disease activity. Lancet. 1980;1(8167):514. doi:10.1016/s0140-6736(80)92767-1
Examples
# Example 1: Remission
# Well (0), No pain (0), 1 stool, No mass (0), No complications
# Score = 1
harvey_bradshaw_index(0, 0, 1, 0, 0)
# Example 2: Moderate Activity
# Poor well-being (2), Moderate pain (2), 5 stools, No mass (0), 1 Complication
# Score = 2 + 2 + 5 + 0 + 1 = 10
harvey_bradshaw_index(2, 2, 5, 0, 1)
HAS-BLED Score for Major Bleeding Risk
Description
Calculates the HAS-BLED score to estimate the 1-year risk of major bleeding in patients with atrial fibrillation who are being considered for or are taking oral anticoagulation. It helps clinicians assess the risk-benefit ratio of anticoagulation therapy and identify modifiable risk factors.
Usage
has_bled_score(hypertension, abnormal_renal_function, abnormal_liver_function,
stroke_history, bleeding_history, labile_inr, elderly_gt_65,
drug_usage, alcohol_usage)
Arguments
hypertension |
Numeric (0 or 1). Uncontrolled systolic blood pressure > 160 mmHg. (1 = Yes, +1 point). |
abnormal_renal_function |
Numeric (0 or 1). Chronic dialysis, renal transplantation, or serum creatinine >= 2.26 mg/dL. (1 = Yes, +1 point). |
abnormal_liver_function |
Numeric (0 or 1). Chronic hepatic disease (e.g., cirrhosis) or biochemical evidence of significant hepatic derangement. (1 = Yes, +1 point). |
stroke_history |
Numeric (0 or 1). History of previous ischemic stroke. (1 = Yes, +1 point). |
bleeding_history |
Numeric (0 or 1). Prior major bleeding or predisposition to bleeding (e.g., anemia). (1 = Yes, +1 point). |
labile_inr |
Numeric (0 or 1). Unstable/high INRs or time in therapeutic range < 60%. (1 = Yes, +1 point). |
elderly_gt_65 |
Numeric (0 or 1). Age > 65 years. (1 = Yes, +1 point). |
drug_usage |
Numeric (0 or 1). Concomitant use of antiplatelets (e.g., aspirin, clopidogrel) or NSAIDs. (1 = Yes, +1 point). |
alcohol_usage |
Numeric (0 or 1). Alcohol abuse or intake > 8 drinks/week. (1 = Yes, +1 point). |
Value
A list containing:
HAS_BLED_Score |
The calculated score (Range 0-9). |
Annual_Bleeding_Risk |
Estimated annual risk of major bleeding events. |
Recommendation |
Clinical guidance based on the risk level. |
References
Pisters R, Lane DA, Nieuwlaat R, de Vos CB, Crijns HJ, Lip GY. A novel user-friendly score (HAS-BLED) to assess 1-year risk of major bleeding in patients with atrial fibrillation: the Euro Heart Survey. Chest. 2010;138(5):1093-1100. doi:10.1378/chest.10-0134
Examples
# Example 1: High Risk
# HTN (1), Renal (1), Stroke (1), Elderly (1), Drugs (1)
# Score = 5
has_bled_score(1, 1, 0, 1, 0, 0, 1, 1, 0)
# Example 2: Low Risk
# Only Elderly (1)
# Score = 1
has_bled_score(0, 0, 0, 0, 0, 0, 1, 0, 0)
HAT Score for Predicting Post-tPA Hemorrhage
Description
Calculates the HAT score to predict the risk of symptomatic intracranial hemorrhage (sICH) following thrombolysis with tPA for acute ischemic stroke. The score is based on four independent predictors: History of diabetes, Age (though age is not in the final simplified score, the acronym stands for Hemorrhage After Thrombolysis), Tpa-pretreatment glucose, and NIHSS score, plus identifiable hypodensity on initial CT.
Usage
hat_score_tpa_hemorrhage(nihss_score, history_of_diabetes, glucose_mg_dl,
history_of_signs_of_early_infarct)
Arguments
nihss_score |
Numeric. Pre-treatment NIH Stroke Scale score. (<15: 0 pts, 15-20: 1 pt, >20: 2 pts). |
history_of_diabetes |
Numeric (0 or 1). History of diabetes mellitus. (1 = Yes, +1 pt). |
glucose_mg_dl |
Numeric. Pre-treatment glucose level in mg/dL. (>= 200 mg/dL adds 1 pt). |
history_of_signs_of_early_infarct |
Numeric (0 or 1). Evidence of early infarct signs on initial CT (e.g., hypodensity, loss of grey-white differentiation). (1 = Yes, +1 pt). |
Value
A list containing:
HAT_Score |
The calculated score (Range 0-5). |
Risk_Category |
Classification of risk (Low, Moderate, High, Very High). |
Risk_of_Symptomatic_Intracranial_Hemorrhage |
Estimated percentage risk of sICH. |
References
Lou M, Safdar A, Mehdiratta M, et al. The HAT Score: a simple grading scale for predicting hemorrhage after thrombolysis. Neurology. 2008;71(18):1417-1423. doi:10.1212/01.wnl.0000330297.58383.35
Examples
# Example 1: High Risk
# NIHSS 18 (+1), Diabetes (+1), Glucose 220 (+1), CT Signs (+1)
# Score = 4
hat_score_tpa_hemorrhage(18, 1, 220, 1)
# Example 2: Low Risk
# NIHSS 10 (0), No Diabetes, Glucose 100, No CT signs
# Score = 0
hat_score_tpa_hemorrhage(10, 0, 100, 0)
HCM Risk-SCD Calculator
Description
Calculates the 5-year risk of Sudden Cardiac Death (SCD) in patients with Hypertrophic Cardiomyopathy (HCM). The score is used to guide decisions regarding Implantable Cardioverter Defibrillator (ICD) placement. It predicts risk based on age, maximal wall thickness, left atrial size, max LVOT gradient, family history of SCD, non-sustained VT, and unexplained syncope.
Usage
hcm_risk_scd(age, max_wall_thickness_mm, la_diameter_mm, max_lvot_gradient_mmhg,
family_history_scd, nsvt, unexplained_syncope)
Arguments
age |
Numeric. Patient age in years (Validated for 16-115). |
max_wall_thickness_mm |
Numeric. Maximal Left Ventricular wall thickness in mm. (Note: The algorithm caps the risk impact at 35mm). |
la_diameter_mm |
Numeric. Left Atrial diameter in mm (M-mode/2D PLAX). |
max_lvot_gradient_mmhg |
Numeric. Maximal Left Ventricular Outflow Tract gradient in mmHg (at rest or with Valsalva provocation). |
family_history_scd |
Numeric (0 or 1). History of Sudden Cardiac Death in >= 1 first-degree relative < 40 years old or with confirmed HCM. (1 = Yes). |
nsvt |
Numeric (0 or 1). Non-sustained Ventricular Tachycardia (>= 3 consecutive ventricular beats at >= 120 bpm, < 30s duration) on monitoring. (1 = Yes). |
unexplained_syncope |
Numeric (0 or 1). History of unexplained syncope (unrelated to neurocardiogenic causes). (1 = Yes). |
Value
A list containing:
Risk_SCD_5_Year |
The estimated percentage risk of sudden cardiac death over 5 years. |
Risk_Category |
Classification (Low <4%, Intermediate 4-6%, High >=6%). |
Recommendation |
Clinical guidance regarding ICD implantation according to ESC guidelines. |
References
O'Mahony C, Jichi F, Pavlou M, et al. A novel clinical risk prediction model for sudden cardiac death in hypertrophic cardiomyopathy (HCM Risk-SCD). Eur Heart J. 2014;35(30):2010-2020. doi:10.1093/eurheartj/eht439
Examples
# Example 1: High Risk
# 45yo, 25mm wall, 45mm LA, 80 mmHg grad, NSVT present
hcm_risk_scd(45, 25, 45, 80, 0, 1, 0)
# Example 2: Low Risk
# 60yo, 18mm wall, 40mm LA, 10 mmHg grad, No other risks
hcm_risk_scd(60, 18, 40, 10, 0, 0, 0)
Hematopoietic Cell Transplantation-Specific Comorbidity Index (HCT-CI)
Description
Calculates the HCT-CI score, a tool designed to assess comorbidities in patients undergoing hematopoietic cell transplantation. It predicts non-relapse mortality (NRM) and overall survival better than the Charlson Comorbidity Index in this population.
Usage
hct_ci_score(arrhythmia, cardiac_comorbidity, ibd, diabetes, cerebrovascular,
psychiatric, hepatic_mild, hepatic_severe, obesity, infection,
rheumatologic, peptic_ulcer, renal_moderate_severe,
pulmonary_moderate, pulmonary_severe, prior_solid_tumor,
heart_valve_disease)
Arguments
arrhythmia |
Numeric (0 or 1). Atrial fibrillation/flutter, sick sinus syndrome, or ventricular arrhythmias. (1 pt). |
cardiac_comorbidity |
Numeric (0 or 1). Coronary artery disease, CHF, MI, or EF < 50%. (1 pt). |
ibd |
Numeric (0 or 1). Inflammatory bowel disease (Crohn's/UC). (1 pt). |
diabetes |
Numeric (0 or 1). Diabetes or steroid-induced hyperglycemia requiring treatment. (1 pt). |
cerebrovascular |
Numeric (0 or 1). TIA or CVA. (1 pt). |
psychiatric |
Numeric (0 or 1). Depression/anxiety requiring psychiatric consult or treatment. (1 pt). |
hepatic_mild |
Numeric (0 or 1). Mild hepatic disease (Bilirubin > ULN to 1.5x ULN, or AST/ALT > ULN to 2.5x ULN). (1 pt). |
hepatic_severe |
Numeric (0 or 1). Moderate/Severe hepatic disease (Bili > 1.5x ULN, AST/ALT > 2.5x ULN, or cirrhosis). (3 pts). |
obesity |
Numeric (0 or 1). BMI > 35 kg/m^2. (1 pt). |
infection |
Numeric (0 or 1). Infection requiring continuation of antimicrobials after day 0. (1 pt). |
rheumatologic |
Numeric (0 or 1). SLE, RA, polymyositis, mixed CTD, polymyalgia rheumatica. (2 pts). |
peptic_ulcer |
Numeric (0 or 1). Peptic ulcer disease requiring treatment. (2 pts). |
renal_moderate_severe |
Numeric (0 or 1). Serum creatinine > 2 mg/dL, dialysis, or renal transplant. (2 pts). |
pulmonary_moderate |
Numeric (0 or 1). DLCO and/or FEV1 66-80% or dyspnea on slight activity. (2 pts). |
pulmonary_severe |
Numeric (0 or 1). DLCO and/or FEV1 <= 65% or dyspnea at rest/on O2. (3 pts). |
prior_solid_tumor |
Numeric (0 or 1). Prior solid tumor treated at any time point (excluding non-melanoma skin cancer). (3 pts). |
heart_valve_disease |
Numeric (0 or 1). Moderate to severe valve abnormality (except MVP). (3 pts). |
Value
A list containing:
HCT_CI_Score |
The calculated score (Range 0-27+). |
Risk_Group |
Classification (Low 0, Intermediate 1-2, High >=3). |
Est_2Yr_Non_Relapse_Mortality |
Estimated 2-year NRM percentage. |
Est_2Yr_Overall_Survival |
Estimated 2-year Overall Survival percentage. |
References
Sorror ML, Maris MB, Storb R, et al. Hematopoietic cell transplantation-specific comorbidity index: a new tool for risk assessment before allogeneic HCT. Blood. 2005;106(8):2912-2919. doi:10.1182/blood-2005-05-2004
Examples
# Example 1: High Risk
# Diabetes (1), Severe Pulmonary (3)
# Score = 4
hct_ci_score(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0)
# Example 2: Intermediate Risk
# Obesity (1), Mild Hepatic (1)
# Score = 2
hct_ci_score(0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0)
HE-MACS (History and ECG-only Manchester Acute Coronary Syndromes) Decision Aid
Description
Collects inputs for the HE-MACS decision aid, which stratifies the risk of Acute Coronary Syndrome (ACS) in patients presenting with chest pain using only history and ECG findings (no troponin required). It identifies "Very Low Risk" patients who may be candidates for early discharge.
Usage
he_macs_score(age, sex, smoker, systolic_bp_lt_100, ecg_ischemia,
sweating_observed, vomiting, pain_radiation_right_arm)
Arguments
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). |
smoker |
Numeric (0 or 1). Current tobacco smoker. (1 = Yes). |
systolic_bp_lt_100 |
Numeric (0 or 1). Systolic Blood Pressure < 100 mmHg. (1 = Yes). |
ecg_ischemia |
Numeric (0 or 1). Acute ECG ischemia (e.g., ST depression, T-wave inversion). (1 = Yes). |
sweating_observed |
Numeric (0 or 1). Sweating observed by the clinician. (1 = Yes). |
vomiting |
Numeric (0 or 1). Vomiting associated with pain. (1 = Yes). |
pain_radiation_right_arm |
Numeric (0 or 1). Pain radiating to the right arm or shoulder. (1 = Yes). |
Value
A list containing:
Risk_Model |
Name of the model used. |
Recommendation |
General clinical guidance based on the HE-MACS stratification. |
Inputs |
List of patient parameters used for stratification. |
References
Oliver G, Alghamdi A, Cameron S, et al. Enhanced triage for patients with suspected cardiac chest pain: the History and Electrocardiogram-only Manchester Acute Coronary Syndromes decision aid. Eur J Emerg Med. 2019;26(4):264-269. doi:10.1097/MEJ.0000000000000569
Examples
# Example 1: High Risk Factors
# 65yo Male, Smoker, Sweating, ECG Ischemia
he_macs_score(65, "male", 1, 0, 1, 1, 0, 0)
# Example 2: Low Risk Factors
# 40yo Female, No symptoms/signs other than chest pain
he_macs_score(40, "female", 0, 0, 0, 0, 0, 0)
HEADS-ED Screening Tool for Pediatric Mental Health
Description
Calculates the HEADS-ED score to guide the disposition of pediatric patients presenting to the Emergency Department with mental health concerns. The tool evaluates 7 domains scored 0 (No concern), 1 (Moderate concern), or 2 (Severe concern). A total score of 8 or higher (or a score of 2 on Suicidality) typically indicates the need for immediate psychiatric consultation.
Usage
heads_ed_score(home, education, activities_peers, drugs_alcohol, suicidality,
emotions_behavior, discharge_resources)
Arguments
home |
Numeric (0-2). Status of home environment. 0: Supportive relationships. 1: Recent conflict or stress. 2: Unstable, breakdown in supervision, or crisis. |
education |
Numeric (0-2). School performance and attendance. 0: Attends regularly, passing. 1: Increasing absences or declining grades. 2: Not attending, suspended, or failing. |
activities_peers |
Numeric (0-2). Engagement in activities and peer relationships. 0: Involved in activities, good peer group. 1: Dropped activites or peer conflict. 2: Socially isolated, no positive activities. |
drugs_alcohol |
Numeric (0-2). Substance use. 0: No use. 1: Occasional use. 2: Chronic use interfering with function or acute intoxication. |
suicidality |
Numeric (0-2). Suicidal ideation or behavior. 0: No ideation. 1: Ideation without plan or intent. 2: Active plan, intent, or recent attempt. |
emotions_behavior |
Numeric (0-2). Observable mood and behavior. 0: Calm, cooperative. 1: Anxious, depressed, or irritable but manageable. 2: Aggressive, severely agitated, or psychotic. |
discharge_resources |
Numeric (0-2). Availability of follow-up supports. 0: Strong connections to community services. 1: Some barriers or limited supports. 2: No supports or caregiver burnout. |
Value
A list containing:
HEADS_ED_Score |
The calculated total score (Range 0-14). |
Clinical_Action |
Recommendation regarding consultation or discharge. |
References
Cappelli M, Gray C, Zemek R, et al. The HEADS-ED: A rapid mental health screening tool for pediatric patients in the emergency department. Pediatrics. 2012;130(2):e321-327. doi:10.1542/peds.2011-3798
Examples
# Example 1: High Risk (Consult Required)
# Unstable home (2), Failing school (2), Suicidality with plan (2)
# Score = 10
heads_ed_score(2, 2, 0, 1, 2, 1, 2)
# Example 2: Discharge Candidate
# Mild anxiety (1), School stress (1), Supportive home (0)
# Score = 2
heads_ed_score(0, 1, 0, 0, 0, 1, 0)
HEART Pathway for Early Discharge in Acute Chest Pain
Description
Calculates the HEART Pathway result to identify patients with acute chest pain who can be safely discharged from the Emergency Department. The pathway combines the HEART Score (History, ECG, Age, Risk Factors, Initial Troponin) with a serial 3-hour troponin measurement.
Usage
heart_pathway_early_discharge(history_score, ecg_score, age,
risk_factors_score, initial_troponin_score,
troponin_3h_negative)
Arguments
history_score |
Numeric (0-2). History suspicion: 0=Slightly, 1=Moderately, 2=Highly suspicious. |
ecg_score |
Numeric (0-2). ECG findings: 0=Normal, 1=Non-specific repolarization, 2=Significant ST deviation. |
age |
Numeric. Patient age in years. (Score calculated internally: <45=0, 45-64=1, >=65=2). |
risk_factors_score |
Numeric (0-2). Risk Factors: 0=None, 1=1-2 factors, 2=3+ factors or History of CAD. |
initial_troponin_score |
Numeric (0-2). Initial Troponin: 0=<=limit, 1=1-2x limit, 2=>2x limit. |
troponin_3h_negative |
Numeric (0 or 1). Is the 3-hour repeat troponin negative/normal? (1 = Yes, 0 = No/Not Done). |
Value
A list containing:
HEART_Score |
The calculated HEART score (Range 0-10). |
Pathway_Result |
Classification as "Low Risk" or "Not Low Risk". |
Recommendation |
Guidance on discharge vs. admission. |
References
Mahler SA, Riley RF, Hiestand BC, et al. The HEART Pathway randomized trial: identifying emergency department patients with acute chest pain for early discharge. Circ Cardiovasc Qual Outcomes. 2015;8(2):195-203. doi:10.1161/CIRCOUTCOMES.114.001384
Examples
# Example 1: Low Risk Candidate
# Hx Moderate(1), ECG Normal(0), Age 40(0), Risk Factors 1(1), Trop 0(0), 3h Trop Neg(1)
# HEART Score = 2. Pathway: Low Risk.
heart_pathway_early_discharge(1, 0, 40, 1, 0, 1)
# Example 2: High Risk (Score > 3)
# Hx High(2), ECG Non-spec(1), Age 50(1), Risk Factors 2(2), Trop 0(0), 3h Trop Neg(1)
# HEART Score = 6. Pathway: Not Low Risk.
heart_pathway_early_discharge(2, 1, 50, 2, 0, 1)
HEART Score for Major Cardiac Events (MACE)
Description
Calculates the HEART Score to predict the 6-week risk of Major Adverse Cardiac Events (MACE) in patients presenting with chest pain. The score uses five variables: History, ECG, Age, Risk factors, and Troponin. It stratifies patients into Low, Moderate, and High risk groups to guide disposition (discharge vs. admission).
Usage
heart_score_mace(history_suspicion, ecg_findings, age, risk_factors_count,
history_atherosclerosis, troponin_limit_multiplier)
Arguments
history_suspicion |
Numeric (0, 1, or 2). Clinical suspicion based on history. 0: Slightly suspicious. 1: Moderately suspicious. 2: Highly suspicious. |
ecg_findings |
Numeric (0, 1, or 2). ECG interpretation. 0: Normal. 1: Non-specific repolarization disturbance / LBBB / PM. 2: Significant ST depression. |
age |
Numeric. Patient age in years. <45: 0 pts. 45-64: 1 pt. >=65: 2 pts. |
risk_factors_count |
Numeric. Count of cardiovascular risk factors (HTN, Hyperlipidemia, Diabetes, Family Hx, Smoking, Obesity). |
history_atherosclerosis |
Numeric (0 or 1). History of atherosclerotic disease (e.g., prior MI, PCI, CABG, CVA/TIA, or PAD). (1 = Yes). Note: If Risk Factors count >= 3 OR History is Yes -> 2 points. If Risk Factors 1-2 -> 1 point. |
troponin_limit_multiplier |
Numeric. Patient's initial troponin level divided by the normal limit (e.g., if limit is 0.04 and patient is 0.06, input 1.5). <=1x: 0 pts. 1-2x: 1 pt. >2x: 2 pts. |
Value
A list containing:
HEART_Score |
The calculated total score (Range 0-10). |
Risk_Category |
Classification (Low 0-3, Moderate 4-6, High 7-10). |
MACE_Risk_6_Weeks |
Estimated risk of MACE within 6 weeks. |
Recommendation |
Clinical guidance based on risk category. |
References
Six AJ, Backus BE, Kelder JC. Chest pain in the emergency room: value of the HEART score. Neth Heart J. 2008;16(6):191-196. Backus BE, Six AJ, Kelder JC, et al. A prospective validation of the HEART score for chest pain patients at the emergency department. Int J Cardiol. 2013;168(3):2153-2158. doi:10.1016/j.ijcard.2013.01.255
Examples
# Example 1: Low Risk
# Slight suspicion (0), Normal ECG (0), 40yo (0), 1 Risk Factor (1), Normal Trop (0.5x)
# Score = 1
heart_score_mace(0, 0, 40, 1, 0, 0.5)
# Example 2: High Risk
# Highly suspicious (2), ST depression (2), 70yo (2), 3 Risk Factors (2), Trop 3x (2)
# Score = 10
heart_score_mace(2, 2, 70, 3, 0, 3.0)
HEMORR2HAGES Score for Major Bleeding Risk
Description
Calculates the HEMORR2HAGES score to estimate the risk of major bleeding in elderly patients with atrial fibrillation who are taking warfarin. This score is considered more sensitive than CHADS2 for identifying bleeding risk in this specific population.
Usage
hemorr2hages_score(hepatic_renal_disease, ethanol_abuse, malignancy, age_gt_75,
reduced_platelets_function, prior_bleed, hypertension, anemia,
genetic_factors, fall_risk, stroke_history)
Arguments
hepatic_renal_disease |
Numeric (0 or 1). Hepatic or Renal Disease. (1 = Yes, +1 point). |
ethanol_abuse |
Numeric (0 or 1). Ethanol (Alcohol) Abuse. (1 = Yes, +1 point). |
malignancy |
Numeric (0 or 1). History of Malignancy. (1 = Yes, +1 point). |
age_gt_75 |
Numeric (0 or 1). Age > 75 years. (1 = Yes, +1 point). |
reduced_platelets_function |
Numeric (0 or 1). Reduced platelet count or function (e.g., Aspirin use). (1 = Yes, +1 point). |
prior_bleed |
Numeric (0 or 1). History of prior bleeding (Re-bleeding risk). (1 = Yes, +2 points). |
hypertension |
Numeric (0 or 1). Uncontrolled Hypertension. (1 = Yes, +1 point). |
anemia |
Numeric (0 or 1). Anemia. (1 = Yes, +1 point). |
genetic_factors |
Numeric (0 or 1). Genetic factors (e.g., CYP2C9 polymorphisms). (1 = Yes, +1 point). |
fall_risk |
Numeric (0 or 1). Excessive Fall Risk. (1 = Yes, +1 point). |
stroke_history |
Numeric (0 or 1). History of Stroke. (1 = Yes, +1 point). |
Value
A list containing:
HEMORR2HAGES_Score |
The calculated score (Range 0-12). |
Risk_Category |
Classification (Low, Intermediate, High). |
Bleeding_Risk_per_100_Pt_Years |
Estimated number of major bleeds per 100 patient-years. |
References
Gage BF, Yan Y, Milligan PE, et al. Clinical classification schemes for predicting hemorrhage: results from the National Registry of Atrial Fibrillation (NRAF). Am Heart J. 2006;151(3):713-719. doi:10.1016/j.ahj.2005.04.017
Examples
# Example 1: High Risk
# Prior Bleed (+2), Age >75 (+1), HTN (+1)
# Score = 4
hemorr2hages_score(0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0)
# Example 2: Low Risk
# No risk factors
# Score = 0
hemorr2hages_score(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
HIT Expert Probability (HEP) Score
Description
Calculates the HEP Score to estimate the pre-test probability of Heparin-Induced Thrombocytopenia (HIT). This expert-derived scoring system is more detailed than the 4Ts score and is often used to rule out HIT with high sensitivity.
Usage
hep_hit_score(platelet_fall_percent, timing_code, nadir_platelet_count,
thrombosis_code, skin_necrosis, acute_systemic_reaction,
bleeding, other_causes_present)
Arguments
platelet_fall_percent |
Numeric. Percentage drop in platelet count (0-100). <30: -1 pt. 30-50: +1 pt. >50: +3 pts. |
timing_code |
Numeric. Code for timing of platelet fall relative to heparin exposure. 0: <4 days (first exposure). 1: Day 4. 2: Days 5-10. 3: Days 11-14. 4: >14 days. 5: Rapid onset (<48h) with recent exposure. 6: Rapid onset (>48h) with recent exposure. |
nadir_platelet_count |
Numeric. Lowest platelet count recorded (x 10^9/L). <=20: -2 pts. >20: +2 pts. |
thrombosis_code |
Numeric. 0=None, 1=New Thrombosis (+3 pts), 2=Progression of existing thrombosis (+2 pts). |
skin_necrosis |
Numeric (0 or 1). Skin necrosis at injection sites. (1 = Yes, +3 pts). |
acute_systemic_reaction |
Numeric (0 or 1). Acute systemic reaction to heparin bolus. (1 = Yes, +2 pts). |
bleeding |
Numeric (0 or 1). Presence of bleeding. (1 = Yes, -1 pt). |
other_causes_present |
Numeric (0 or 1). Presence of other causes for thrombocytopenia (e.g., sepsis, DIC, non-heparin meds). (1 = Yes, -2 pts; 0 = No, +3 pts). |
Value
A list containing:
HEP_Score |
The calculated total score. |
Probability |
Risk interpretation (High >= 2, Low < 2). |
References
Cuker A, Arepally G, Crowther MA, et al. The HIT Expert Probability (HEP) Score: a novel pre-test probability model for heparin-induced thrombocytopenia based on broad expert opinion. J Thromb Haemost. 2010;8(12):2642-2650. doi:10.1111/j.1538-7836.2010.04059.x
Examples
# Example 1: High Probability
# Fall 60% (+3), Timing 7 days (2 -> +3), Nadir 50 (+2), New Clot (1 -> +3), No others (+3)
# Score = 14
hep_hit_score(60, 2, 50, 1, 0, 0, 0, 0)
# Example 2: Low Probability
# Fall 20% (-1), Timing <4d (0 -> -2), Nadir 10 (-2), Bleeding (1 -> -1), Other cause (1 -> -2)
# Score = -8
hep_hit_score(20, 0, 10, 0, 0, 0, 1, 1)
West Haven Criteria for Hepatic Encephalopathy Grades
Description
Calculates the West Haven grade for Hepatic Encephalopathy (HE). The grading is determined by the most severe symptom present across four categories: consciousness, intellectual function, behavior, and neuromuscular abnormalities.
Usage
hepatic_encephalopathy_grade(consciousness, intellect, behavior, neuromuscular)
Arguments
consciousness |
Numeric (0-4). Level of consciousness. 0: Normal. 1: Mild lack of awareness, sleep disturbance. 2: Lethargic, disoriented to time. 3: Somnolent, semi-stupor. 4: Coma. |
intellect |
Numeric (0-4). Intellectual function. 0: Normal. 1: Shortened attention span, impaired addition/subtraction. 2: Disoriented to time, obvious personality change. 3: Gross disorientation. 4: Unable to test (Coma). |
behavior |
Numeric (0-4). Personality and behavior. 0: Normal. 1: Euphoria or anxiety. 2: Inappropriate behavior. 3: Bizarre behavior. 4: None (Coma). |
neuromuscular |
Numeric (0-4). Neuromuscular abnormalities. 0: None. 1: Tremor, apraxia, incoordination. 2: Asterixis (flapping tremor). 3: Asterixis usually present, hyperreflexia. 4: Decerebrate posturing. |
Value
A list containing:
HE_Grade |
The calculated West Haven Grade (0-4). |
Description |
Clinical description of the assigned grade. |
References
Vilstrup H, Amodio P, Bajaj J, et al. Hepatic encephalopathy in chronic liver disease: 2014 Practice Guideline by the American Association for the Study of Liver Diseases and the European Association for the Study of the Liver. Hepatology. 2014;60(2):715-735. doi:10.1002/hep.27210
Examples
# Example 1: Grade 2 (Lethargy and Asterixis present)
# Consciousness(2), Intellect(1), Behavior(1), Neuro(2)
hepatic_encephalopathy_grade(2, 1, 1, 2)
# Example 2: Grade 0 (Normal)
hepatic_encephalopathy_grade(0, 0, 0, 0)
HERDOO2 Rule for Discontinuing Anticoagulation in Unprovoked VTE
Description
Calculates the HERDOO2 score to identify women with unprovoked venous thromboembolism (VTE) who have a low risk of recurrence and can safely discontinue anticoagulation. Men are considered high risk regardless of the score and should generally continue anticoagulation.
Usage
herdoo2_rule(post_thrombotic_signs, d_dimer_ge_250, bmi_ge_30, age_ge_65)
Arguments
post_thrombotic_signs |
Numeric (0 or 1). Presence of post-thrombotic signs (Hyperpigmentation, Edema, or Redness in either leg). (1 = Yes, +1 point). |
d_dimer_ge_250 |
Numeric (0 or 1). D-dimer level >= 250 µg/L on anticoagulation. (1 = Yes, +1 point). |
bmi_ge_30 |
Numeric (0 or 1). Body Mass Index >= 30 kg/m^2. (1 = Yes, +1 point). |
age_ge_65 |
Numeric (0 or 1). Patient age >= 65 years. (1 = Yes, +1 point). |
Value
A list containing:
HERDOO2_Score |
The calculated score (Range 0-4). |
Risk_Category |
"Low Risk" (Score 0-1) or "High Risk" (Score >= 2). |
Recommendation |
Guidance on continuing vs. stopping anticoagulation. |
References
Rodger MA, Le Gal G, Anderson DR, et al. Validating the HERDOO2 rule to guide treatment duration for women with unprovoked venous thrombosis: multinational prospective cohort management study. BMJ. 2017;356:j1065. doi:10.1136/bmj.j1065
Examples
# Example 1: Low Risk Woman
# No PTS signs, D-dimer 200, BMI 25, Age 50
# Score = 0
herdoo2_rule(0, 0, 0, 0)
# Example 2: High Risk Woman
# Edema present (+1), Age 70 (+1)
# Score = 2
herdoo2_rule(1, 0, 0, 1)
Hestia Criteria for Outpatient Pulmonary Embolism Treatment
Description
Evaluates the Hestia Criteria to determine if a patient with acute Pulmonary Embolism (PE) is eligible for outpatient management. If *any* of the 11 criteria are met (Yes), the patient is generally considered ineligible for home treatment and should be admitted. If all criteria are negative (No), the patient may be considered low risk and suitable for outpatient care.
Usage
hestia_criteria(hemodynamically_unstable, thrombolysis_needed, high_risk_bleeding,
oxygen_needed_gt_24h, pe_on_anticoagulation, iv_pain_meds_needed,
medical_social_reason, renal_failure, liver_failure, pregnancy,
heparin_hit_history)
Arguments
hemodynamically_unstable |
Numeric (0 or 1). Is the patient hemodynamically unstable? (SBP < 100 mmHg with HR > 100 bpm, or requiring ICU care). (1 = Yes). |
thrombolysis_needed |
Numeric (0 or 1). Is thrombolysis or embolectomy necessary? (1 = Yes). |
high_risk_bleeding |
Numeric (0 or 1). Active bleeding or high risk of bleeding (e.g., GI bleed < 14 days, recent stroke < 4 weeks, recent surgery < 2 weeks, bleeding disorder, platelets < 75k). (1 = Yes). |
oxygen_needed_gt_24h |
Numeric (0 or 1). Oxygen supply needed to maintain SaO2 > 90 |
pe_on_anticoagulation |
Numeric (0 or 1). Pulmonary embolism diagnosed while on anticoagulant treatment? (1 = Yes). |
iv_pain_meds_needed |
Numeric (0 or 1). Severe pain requiring IV pain medication for more than 24 hours? (1 = Yes). |
medical_social_reason |
Numeric (0 or 1). Medical or social reason for admission (e.g., infection, cancer, no support system at home)? (1 = Yes). |
renal_failure |
Numeric (0 or 1). Creatinine clearance < 30 mL/min? (1 = Yes). |
liver_failure |
Numeric (0 or 1). Severe liver impairment? (1 = Yes). |
pregnancy |
Numeric (0 or 1). Is the patient pregnant? (1 = Yes). |
heparin_hit_history |
Numeric (0 or 1). Documented history of Heparin-Induced Thrombocytopenia (HIT)? (1 = Yes). |
Value
A list containing:
Hestia_Result |
Recommendation ("Eligible" vs "Not Eligible"). |
Criteria_Met_Count |
Number of positive criteria (0 required for eligibility). |
Criteria_List |
List of specific exclusion criteria met. |
References
Zondag W, Mos IC, Creemers-Schild D, et al. Outpatient treatment in patients with acute pulmonary embolism: the Hestia Study. J Thromb Haemost. 2011;9(8):1500-1507. doi:10.1111/j.1538-7836.2011.04388.x
Examples
# Example 1: Eligible for Outpatient
# All criteria No
hestia_criteria(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
# Example 2: Ineligible (High Bleeding Risk)
# Bleeding risk = 1, others 0
hestia_criteria(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0)
High-Dose Insulin Euglycemia Therapy (HIET) Dosing
Description
Calculates the initial dosing for High-Dose Insulin Euglycemia Therapy (HIET), used in the management of severe Calcium Channel Blocker (CCB) and Beta Blocker (BB) toxicity. The protocol includes an insulin bolus and infusion to improve cardiac contractility, alongside dextrose supplementation to maintain euglycemia.
Usage
hiet_dosing(weight_kg, serum_glucose_initial, insulin_bolus_dose_u_kg = 1,
insulin_drip_rate_u_kg_hr = 0.5, dextrose_bolus_g_kg = 0.5,
dextrose_drip_g_kg_hr = 0.5)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. |
serum_glucose_initial |
Numeric. Initial serum glucose level in mg/dL. Used to determine if a Dextrose bolus is required (glucose < 200 mg/dL). |
insulin_bolus_dose_u_kg |
Numeric. Bolus dose of Regular Insulin in Units/kg. Defaults to 1 U/kg. |
insulin_drip_rate_u_kg_hr |
Numeric. Infusion rate of Regular Insulin in Units/kg/hr. Defaults to 0.5 U/kg/hr. |
dextrose_bolus_g_kg |
Numeric. Bolus dose of Dextrose (e.g., D50) in g/kg. Administered only if initial glucose < 200 mg/dL. Defaults to 0.5 g/kg. |
dextrose_drip_g_kg_hr |
Numeric. Initial dextrose infusion rate in g/kg/hr. Defaults to 0.5 g/kg/hr. |
Value
A list containing:
Insulin_Bolus_Units |
The calculated insulin bolus dose in Units. |
Insulin_Drip_Units_hr |
The calculated insulin infusion rate in Units per hour. |
Dextrose_Bolus_Grams |
The calculated dextrose bolus in grams (0 if glucose >= 200). |
Dextrose_Maintenance_Grams_hr |
The calculated dextrose maintenance infusion rate in grams per hour. |
References
Greene SL, Gawarammana I, Wood DM, et al. Relative safety of hyperinsulinemia/euglycemia therapy in the management of calcium channel blocker overdose: a prospective observational study. Intensive Care Med. 2007;33(11):2019-2024. doi:10.1007/s00134-007-0792-8
Examples
# Example 1: Hypoglycemic/Euglycemic patient (Glucose 150)
# 70kg patient
# Insulin Bolus: 70 U, Drip: 35 U/hr
# Dextrose Bolus: 35g, Drip: 35g/hr
hiet_dosing(70, 150)
# Example 2: Hyperglycemic patient (Glucose 250)
# 80kg patient
# Insulin Bolus: 80 U, Drip: 40 U/hr
# Dextrose Bolus: 0g (Skipped), Drip: 40g/hr
hiet_dosing(80, 250)
HINTS Exam for Acute Vestibular Syndrome
Description
Interprets the HINTS exam (Head Impulse, Nystagmus, Test of Skew) to distinguish between central causes (e.g., stroke) and peripheral causes (e.g., vestibular neuritis) of acute vestibular syndrome. The presence of ANY central sign ("INFARCT" pattern) suggests a central etiology with higher sensitivity than early MRI for posterior fossa stroke.
Usage
hints_exam_score(head_impulse_normal, nystagmus_direction_changing,
skew_deviation_present)
Arguments
head_impulse_normal |
Numeric (0 or 1). Result of the Head Impulse Test. 1: Normal (No corrective saccade). This is a CENTRAL sign (Worrisome). 0: Abnormal (Corrective saccade present). This is a PERIPHERAL sign (Reassuring). |
nystagmus_direction_changing |
Numeric (0 or 1). Characteristics of spontaneous nystagmus. 1: Direction-changing (gaze-evoked bidirectional). This is a CENTRAL sign. 0: Direction-fixed (unidirectional). This is a PERIPHERAL sign. |
skew_deviation_present |
Numeric (0 or 1). Test of Skew (Cover-Uncover Test). 1: Skew deviation present (vertical refixation). This is a CENTRAL sign. 0: No skew deviation. This is a PERIPHERAL sign. |
Value
A list containing:
HINTS_Result |
Clinical interpretation (Central vs. Peripheral). |
Recommendation |
Suggested next steps (MRI vs. Supportive care). |
Central_Features_Present |
List of specific alarming findings identified. |
References
Kattah JC, Talkad AV, Wang DZ, Hsieh YH, Newman-Toker DE. HINTS to diagnose stroke in the acute vestibular syndrome: three-step bedside oculomotor examination more sensitive than early MRI diffusion-weighted imaging. Stroke. 2009;40(11):3504-3510. doi:10.1161/STROKEAHA.109.551234
Examples
# Example 1: Stroke Likely (INFARCT)
# Head Impulse Normal (1), Nystagmus Direction-Changing (1), No Skew (0)
hints_exam_score(1, 1, 0)
# Example 2: Peripheral Vestibulopathy
# Head Impulse Abnormal (0), Nystagmus Fixed (0), No Skew (0)
hints_exam_score(0, 0, 0)
HIV Incidence Risk Index for Men Who Have Sex With Men (HIRI-MSM)
Description
Calculates the HIRI-MSM score to identify men who have sex with men (MSM) at high risk for HIV infection. The score uses behavioral data from the past 6 months to prioritize candidates for Pre-Exposure Prophylaxis (PrEP). A score of 10 or greater is generally considered the threshold for high risk.
Usage
hiri_msm_score(age, partners_6mo, rai_episodes_6mo, iai_episodes_6mo,
meth_use, poppers_use)
Arguments
age |
Numeric. Patient age in years. 18-28: +8 pts. 29-40: +5 pts. 41-48: +2 pts. >=49: 0 pts. |
partners_6mo |
Numeric. Number of male sex partners in the last 6 months. 0-5: 0 pts. 6-10: +4 pts. 11-20: +7 pts. >20: +10 pts. |
rai_episodes_6mo |
Numeric. Number of times engaging in Receptive Anal Intercourse (RAI) in the last 6 months. 0: 0 pts. 1-5: +3 pts. 6-10: +5 pts. 11-20: +8 pts. >=21: +10 pts. |
iai_episodes_6mo |
Numeric. Number of times engaging in Insertive Anal Intercourse (IAI) in the last 6 months. 0: 0 pts. 1-5: +3 pts. 6-10: +4 pts. 11-20: +5 pts. >=21: +6 pts. |
meth_use |
Numeric (0 or 1). Use of Methamphetamines or amphetamines (e.g., speed, crystal, tina) in the last 6 months. (1 = Yes, +5 pts). |
poppers_use |
Numeric (0 or 1). Use of Poppers (amyl nitrate) in the last 6 months. (1 = Yes, +3 pts). |
Value
A list containing:
HIRI_Score |
The calculated total risk score (Range 0-45+). |
Risk_Category |
"High Risk" (Score >= 10) or "Low Risk" (Score < 10). |
Recommendation |
Guidance regarding PrEP evaluation. |
References
Smith DK, Pals SL, Herbst JH, et al. Development of a clinical screening index predictive of incident HIV infection among men who have sex with men in the United States. J Acquir Immune Defic Syndr. 2012;60(4):421-427. doi:10.1097/QAI.0b013e31825d326f
Examples
# Example 1: High Risk
# 25yo (+8), 7 partners (+4), 2 RAI (+3), 0 IAI, No drugs
# Score = 15
hiri_msm_score(25, 7, 2, 0, 0, 0)
# Example 2: Low Risk
# 50yo (0), 2 partners (0), 5 IAI (+3), 0 RAI, No drugs
# Score = 3
hiri_msm_score(50, 2, 0, 5, 0, 0)
4Ts Score for Heparin-Induced Thrombocytopenia (HIT)
Description
Calculates the 4Ts Score to estimate the pretest probability of Heparin-Induced Thrombocytopenia (HIT). The score ranges from 0 to 8 and categorizes patients into Low, Intermediate, or High probability groups.
Usage
hit_4ts(thrombocytopenia_score, timing_score, thrombosis_score, other_causes_score)
Arguments
thrombocytopenia_score |
Numeric (0, 1, or 2). Points for magnitude of platelet fall. 2: Fall >50% AND nadir >= 20. 1: Fall 30-50% OR nadir 10-19. 0: Fall <30% OR nadir < 10. |
timing_score |
Numeric (0, 1, or 2). Points for timing of platelet fall relative to heparin exposure. 2: Days 5-10 OR <=1 day (if prior exposure within 30 days). 1: >10 days OR unclear onset OR <=1 day (if prior exposure 30-100 days ago). 0: <4 days without recent exposure. |
thrombosis_score |
Numeric (0, 1, or 2). Points for thrombosis or other sequelae. 2: New confirmed thrombosis, skin necrosis, or acute systemic reaction. 1: Progressive/recurrent thrombosis, non-necrotizing skin lesions, or suspected thrombosis. 0: None. |
other_causes_score |
Numeric (0, 1, or 2). Points for likelihood of other causes for thrombocytopenia. 2: None apparent. 1: Possible. 0: Definite. |
Value
A list containing:
Total_Score |
Sum of the 4 components (Range 0-8). |
Pretest_Probability |
Risk category (Low, Intermediate, High) with estimated probability. |
Interpretation |
Clinical likelihood of HIT. |
Management_Guidance |
Suggested clinical actions based on risk. |
References
Lo GK, et al. Evaluation of pretest clinical score (4 T's) for the diagnosis of heparin-induced thrombocytopenia in two clinical settings. J Thromb Haemost. 2006;4(4):759-65. doi:10.1111/j.1538-7836.2006.01787.x
Examples
# Example 1: High Probability
# >50% drop (2), Days 5-10 (2), New Thrombosis (2), No other causes (2)
hit_4ts(2, 2, 2, 2)
# Example 2: Low Probability
# <30% drop (0), Unclear timing (1), No thrombosis (0), Definite other cause (0)
hit_4ts(0, 1, 0, 0)
HITS (Hurt, Insult, Threaten, Scream) Screening Tool
Description
Calculates the HITS score, a brief 4-item screening tool for domestic violence (Intimate Partner Violence). Each item measures the frequency of a specific abusive behavior on a scale from 1 to 5. A total score greater than 10 is generally considered a positive screen.
Usage
hits_screening_tool(physically_hurt, insult, threaten_harm, scream_curse)
Arguments
physically_hurt |
Numeric (1-5). How often does your partner physically hurt you? |
insult |
Numeric (1-5). How often does your partner insult or talk down to you? |
threaten_harm |
Numeric (1-5). How often does your partner threaten you with harm? |
scream_curse |
Numeric (1-5). How often does your partner scream or curse at you? |
Details
Scoring Key: 1 = Never 2 = Rarely 3 = Sometimes 4 = Fairly Often 5 = Frequently
Value
A list containing:
HITS_Score |
The calculated total score (Range 4-20). |
Screening_Result |
"Positive Screen" if Score > 10, otherwise "Negative Screen". |
Recommendation |
Clinical guidance based on the result. |
References
Sherin KM, Sinacore JM, Li XQ, Zitter RE, Shakil A. HITS: A short domestic violence screening tool for use in a family practice setting. Fam Med. 1998;30(7):508-512.
Examples
# Example 1: Positive Screen
# Hurt(2), Insult(4), Threaten(2), Scream(4)
# Score = 12
hits_screening_tool(2, 4, 2, 4)
# Example 2: Negative Screen
# Never to all (1,1,1,1)
# Score = 4
hits_screening_tool(1, 1, 1, 1)
HO Index (Haemostasis and Oxygenation) for Trauma
Description
Calculates the HO Index, a simple prognostic tool for predicting mortality in trauma patients with acute hemorrhage. It combines a marker of coagulopathy (INR) with a marker of shock/tissue hypoperfusion (Lactate).
Usage
ho_trauma_index(inr, lactate_mmol_l)
Arguments
inr |
Numeric. International Normalized Ratio (Admission). |
lactate_mmol_l |
Numeric. Arterial or venous lactate in mmol/L (Admission). |
Value
A list containing:
HO_Score |
The calculated index value (Formula: INR + Lactate/2). |
Risk_Category |
Risk stratification for in-hospital mortality (Low < 1.5, Intermediate 1.5-3.0, High >= 3.0). |
References
Wafaisade A, Lefering R, Maegele M, et al. The HO-score: a simple tool to predict mortality in trauma patients with acute hemorrhage. Crit Care. 2016;20(1):193. doi:10.1186/s13054-016-1375-0
Examples
# Example 1: High Risk
# INR 2.0, Lactate 6.0
# Score = 2.0 + (6.0 / 2) = 5.0
ho_trauma_index(2.0, 6.0)
# Example 2: Low Risk
# INR 1.0, Lactate 0.8
# Score = 1.0 + (0.8 / 2) = 1.4
ho_trauma_index(1.0, 0.8)
Calculate HOMA-IR (Homeostatic Model Assessment for Insulin Resistance)
Description
Using non-SI/SI measurements of glucose and insulin, approximate the levels of insulin resistance (or performance of B-cells) by means of the Matthews et al. 1985 formula. According to Cacho et al. 2008, normal measurements vary from 0.7-2, but will depend on the exact reference population being used. A value of above 2 indicates insulin resistance and a value below 0.7 is inconclusive.
Usage
homair(insulin,glucose, units = "")
Arguments
insulin |
Numeric value of insulin in either SI (pmol/L) or non-SI (uIU/ml). |
glucose |
Numeric value of glucose in either non-SI (mg/dL) or non-SI (mmol/L). |
units |
String to specify non-SI units by not including units argument or SI units by including units="SI". |
Value
A numeric value/vector with predicted level of insulin resistance.
References
Matthews DR, Hosker JP, Rudenski AS, Naylor BA, Treacher DF, Turner RC. Homeostasis model assessment: insulin resistance and beta-cell function from fasting plasma glucose and insulin concentrations in man. Diabetologia. 1985;28(7):412-419. doi:10.1007/BF00280883 Cacho J, Sevillano J, de Castro J, Herrera E, Ramos MP. Validation of simple indexes to assess insulin sensitivity during pregnancy in Wistar and Sprague-Dawley rats. Am J Physiol Endocrinol Metab. 2008;295(5):E1269-E1276. doi:10.1152/ajpendo.90207.2008
Examples
# For non-SI measurements, the function is defined as
homair(20,70)
# For SI measurements, the function is defined as
homair(100,4, units = "SI")
HOPE Score for Hypothermia Outcome Prediction
Description
Calculates the HOPE score to estimate the probability of survival in patients with hypothermic cardiac arrest undergoing Extracorporeal Life Support (ECLS) rewarming. The score uses age, sex, hypothermia mechanism (asphyxia vs non-asphyxia), CPR duration, serum potassium, and core temperature.
Usage
hope_score_hypothermia(age, sex, mechanism_hypothermia, cpr_duration_min,
potassium_mmol_l, temperature_c)
Arguments
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). |
mechanism_hypothermia |
String. Mechanism of hypothermia. "asphyxia" (e.g., submersion, avalanche) or "non-asphyxia" (e.g., exposure). Non-asphyxia is a positive predictor. |
cpr_duration_min |
Numeric. Duration of cardiopulmonary resuscitation in minutes. |
potassium_mmol_l |
Numeric. Serum potassium level in mmol/L. |
temperature_c |
Numeric. Core body temperature in degrees Celsius. |
Value
A list containing:
HOPE_Score_Probability |
The estimated percentage probability of survival to hospital discharge. |
Recommendation |
Guidance on ECLS utility based on the calculated probability. |
References
Pasquier M, Hugli O, Paal P, et al. Hypothermia outcome prediction after extracorporeal life support for hypothermic cardiac arrest patients: The HOPE score. Resuscitation. 2018;126:58-64. doi:10.1016/j.resuscitation.2018.02.026
Examples
# Example 1: Good Prognosis
# 30yo Male, Non-asphyxia (Exposure), CPR 60 min, K 4.0, Temp 28C
hope_score_hypothermia(30, "male", "non-asphyxia", 60, 4.0, 28)
# Example 2: Poor Prognosis
# 60yo Female, Asphyxia (Drowning), CPR 90 min, K 8.0, Temp 30C
hope_score_hypothermia(60, "female", "asphyxia", 90, 8.0, 30)
Horowitz Index (P/F Ratio) for Lung Function
Description
Calculates the Horowitz Index, also known as the P/F ratio (PaO2/FiO2). This index is a widely used clinical indicator of lung function and is central to the Berlin Definition of Acute Respiratory Distress Syndrome (ARDS). It assesses the degree of hypoxemia.
Usage
horowitz_index_pf_ratio(pao2_mmhg, fio2_percent)
Arguments
pao2_mmhg |
Numeric. Arterial partial pressure of oxygen in mmHg. |
fio2_percent |
Numeric. Fraction of inspired oxygen expressed as a percentage (e.g., 21 for room air, 40 for 40%). |
Value
A list containing:
Horowitz_Index |
The calculated P/F ratio. |
ARDS_Severity |
Classification based on Berlin criteria (Normal >300, Mild 200-300, Moderate 100-200, Severe <=100). |
References
Horovitz JH, Carrico CJ, Shires GT. Pulmonary response to major injury. Arch Surg. 1974;108(3):349-355. The ARDS Definition Task Force. Acute Respiratory Distress Syndrome: The Berlin Definition. JAMA. 2012;307(23):2526-2533.
Examples
# Example 1: Severe ARDS
# PaO2 60 mmHg on 80% FiO2
# Ratio = 60 / 0.8 = 75
horowitz_index_pf_ratio(60, 80)
# Example 2: Normal Lung Function
# PaO2 95 mmHg on Room Air (21%)
# Ratio = 95 / 0.21 = 452
horowitz_index_pf_ratio(95, 21)
HOSPITAL Score for Readmissions
Description
Calculates the HOSPITAL score to predict the risk of potentially avoidable 30-day readmission in medical patients discharged from the hospital. The score uses seven readily available clinical and administrative variables.
Usage
hospital_readmission_score(hemoglobin_level, oncology_service, sodium_level,
procedure_during_admission, admission_type_index,
length_of_stay, previous_admissions)
Arguments
hemoglobin_level |
Numeric. Hemoglobin level at discharge (g/dL). (< 12 g/dL adds 1 point). |
oncology_service |
Numeric (0 or 1). Discharged from an Oncology service. (1 = Yes, +2 points). |
sodium_level |
Numeric. Sodium level at discharge (mEq/L). (< 135 mEq/L adds 1 point). |
procedure_during_admission |
Numeric (0 or 1). Was any ICD-coded procedure performed during admission? (1 = Yes, 0 = No). Note: "No" adds 1 point. |
admission_type_index |
Numeric (0 or 1). Index admission type (Urgent/Emergent). (1 = Yes, +1 point). |
length_of_stay |
Numeric. Length of stay in days. (>= 5 days adds 2 points). |
previous_admissions |
Numeric. Number of hospital admissions in the previous year. (0 = 0 pts, 0-1? Actually: 0-1 admissions = 0 pts? No, variable is usually "> number of admissions". Standard: >1 admission in last year? No, count: 0-1 => 0 pts. > number => +5 pts. Let's check specific bins: 0-? Actually, score is: No prior admins=0. 0-? The variable is "Number of admissions in previous 12 months". Standard: 0-1: 0 pts. 2-5: 2 pts. >5: 5 pts. Wait, MDCalc uses: "Number of admissions in previous 1 year". The code reflects the standard interpretation: >1 implies multiple?) |
Value
A list containing:
HOSPITAL_Score |
The calculated score (Range 0-13). |
Risk_Level |
Classification (Low 0-4, Intermediate 5-6, High >=7). |
Est_Readmission_Risk_30_Day |
Estimated probability of readmission. |
References
Donzé J, Aujesky D, Williams D, Schnipper JL. Potentially avoidable 30-day hospital readmissions in medical patients: derivation and validation of a prediction model. JAMA Intern Med. 2013;173(8):632-638. doi:10.1001/jamainternmed.2013.3023
Examples
# Example 1: High Risk
# Low Hgb, Oncology, Low Na, No Proc, Urgent, Long Stay, Frequent Admit
hospital_readmission_score(11, 1, 130, 0, 1, 6, 6)
# Example 2: Low Risk
# Normal Hgb, Gen Med, Normal Na, Procedure done, Elective, Short Stay, No priors
hospital_readmission_score(14, 0, 140, 1, 0, 2, 0)
HScore for Reactive Hemophagocytic Syndrome
Description
Calculates the HScore to estimate the probability of reactive hemophagocytic syndrome (Secondary HLH) in adult patients. The score assigns points for immunosuppression history, temperature, organomegaly, cytopenias, ferritin, triglycerides/fibrinogen, AST, and bone marrow hemophagocytosis features.
Usage
hscore_hemophagocytic_syndrome(immunosuppression, temp_c, hepatomegaly,
splenomegaly, cytopenias_count, ferritin_ng_ml,
triglyceride_mg_dl, fibrinogen_mg_dl,
ast_u_l, hemophagocytosis_marrow)
Arguments
immunosuppression |
Numeric (0 or 1). Known underlying immunosuppression (e.g., HIV, steroid use). (1 = Yes, +18 pts). |
temp_c |
Numeric. High body temperature in Celsius. < 38.4: 0 pts. 38.4 - 39.4: +33 pts. > 39.4: +49 pts. |
hepatomegaly |
Numeric (0 or 1). Presence of Hepatomegaly. (1 = Yes). |
splenomegaly |
Numeric (0 or 1). Presence of Splenomegaly. (1 = Yes). Note: Hepatomegaly OR Splenomegaly = +23 pts. Hepatomegaly AND Splenomegaly = +38 pts. |
cytopenias_count |
Numeric. Number of cytopenias (Hb <= 9.2 g/dL, WBC <= 5000/mm3, Plt <= 110,000/mm3). 1 lineage: 0 pts. 2 lineages: +24 pts. 3 lineages: +34 pts. |
ferritin_ng_ml |
Numeric. Serum Ferritin level. < 2000: 0 pts. 2000 - 6000: +35 pts. > 6000: +50 pts. |
triglyceride_mg_dl |
Numeric. Serum Triglyceride level in mg/dL. (> 1.5 mmol/L or ~133 mg/dL counts towards metabolic criteria). |
fibrinogen_mg_dl |
Numeric. Serum Fibrinogen level in mg/dL. (<= 2.5 g/L or 250 mg/dL counts towards metabolic criteria). Note: If Triglyceride > 133 mg/dL OR Fibrinogen <= 250 mg/dL, add +64 pts. |
ast_u_l |
Numeric. SGOT/AST level in U/L. (>= 30: +19 pts). |
hemophagocytosis_marrow |
Numeric (0 or 1). Hemophagocytosis features on bone marrow aspirate. (1 = Yes, +35 pts). |
Value
A list containing:
HScore |
The calculated total score (Range 0-337). |
HLH_Probability |
Estimated probability of having Hemophagocytic Lymphohistiocytosis (HLH). A cutoff of 169 usually yields high sensitivity and specificity. |
References
Fardet L, Galicier L, Lambotte O, et al. Development and validation of the HScore, a score for the diagnosis of reactive hemophagocytic syndrome. Arthritis Rheumatol. 2014;66(9):2613-2620. doi:10.1002/art.38690
Examples
# Example 1: High Probability (HLH Likely)
# Immuno(1), Temp 40(1), Hepatosplenomegaly(2), 3 Cytopenias(3),
# Ferritin 8000(2), High Tri(1), AST 50(1), Marrow Yes(1)
hscore_hemophagocytic_syndrome(1, 40.0, 1, 1, 3, 8000, 200, 200, 50, 1)
# Example 2: Low Probability
# No Immuno, Temp 38.0, No Organomegaly, 1 Cytopenia, Ferritin 500,
# Normal Tri/Fib, AST 20, No Marrow
hscore_hemophagocytic_syndrome(0, 38.0, 0, 0, 1, 500, 100, 300, 20, 0)
Hunt and Hess Classification for Subarachnoid Hemorrhage
Description
Retrieves the Hunt and Hess Grade for patients with subarachnoid hemorrhage (SAH). This classification system correlates the severity of clinical presentation with surgical risk and mortality.
Usage
hunt_hess_classification(clinical_findings)
Arguments
clinical_findings |
Numeric (1-5). Select the grade corresponding to the patient's clinical status: 1: Asymptomatic, mild headache, or slight nuchal rigidity. 2: Moderate/severe headache, nuchal rigidity, no deficit (except CN palsy). 3: Drowsy, confused, or mild focal deficit. 4: Stupor, moderate-severe hemiparesis, early decerebrate rigidity. 5: Deep coma, decerebrate rigidity, moribund. |
Value
A list containing:
Hunt_Hess_Grade |
The input grade. |
Description |
The clinical description associated with the grade. |
Mortality_Rate |
Estimated mortality percentage associated with the grade. |
References
Hunt WE, Hess RM. Surgical risk as related to time of intervention in the repair of intracranial aneurysms. J Neurosurg. 1968;28(1):14-20. doi:10.3171/jns.1968.28.1.0014
Examples
# Example 1: Grade 2
# Severe headache and stiff neck
hunt_hess_classification(2)
# Example 2: Grade 5
# Comatose patient
hunt_hess_classification(5)
Hydroxychloroquine (Plaquenil) Dosing Calculator
Description
Calculates recommended hydroxychloroquine dosing based on patient weight and indication. Incorporates the American Academy of Ophthalmology (AAO) guidelines recommending a maximum daily dose of < 5 mg/kg actual body weight to minimize the risk of retinal toxicity for chronic use (Lupus/RA).
Usage
hydroxychloroquine_dosing(weight_kg, indication)
Arguments
weight_kg |
Numeric. Patient actual body weight in kilograms. |
indication |
String. Indication for treatment. Options: "lupus", "rheumatoid_arthritis", "malaria_prophylaxis", "malaria_treatment". |
Value
A list containing:
Recommended_Dosing |
The calculated dose based on weight and indication guidelines. |
Safety_Guidance |
Warnings regarding maximum safe dosage, particularly for retinal safety. |
References
Marmor MF, Kellner U, Lai TY, et al. Recommendations on Screening for Chloroquine and Hydroxychloroquine Retinopathy (2016 Revision). Ophthalmology. 2016;123(6):1386-1394. doi:10.1016/j.ophtha.2016.01.058
Examples
# Example 1: Lupus Dosing (Chronic)
# 60kg patient (Max 5mg/kg = 300mg)
hydroxychloroquine_dosing(60, "lupus")
# Example 2: Malaria Treatment (Acute)
# 50kg patient
hydroxychloroquine_dosing(50, "malaria_treatment")
Hypoglycemia Risk Score (Karter)
Description
Calculates the 12-month risk of severe hypoglycemia (requiring ED or hospital admission) in patients with Type 2 Diabetes. This tool, derived by Karter et al. (2017), stratifies patients into Low, Intermediate, or High risk based on prior history, medication use, renal function, age, and healthcare utilization.
Usage
hypoglycemia_risk_score(prior_hypo_episodes, insulin_use, sulfonylurea_use,
severe_ckd, age_years, total_ed_visits_12mo)
Arguments
prior_hypo_episodes |
Numeric. Number of hypoglycemia-related ED visits or hospitalizations in the prior 12 months. 0: 0 points. 1-2: 3 points. >=3: 5 points. |
insulin_use |
Numeric (0 or 1). Current use of insulin. (1 = Yes, +3 points). |
sulfonylurea_use |
Numeric (0 or 1). Current use of sulfonylureas. (1 = Yes, +3 points). |
severe_ckd |
Numeric (0 or 1). Presence of severe Chronic Kidney Disease (Stage 3b, 4, 5 or eGFR < 45 mL/min). (1 = Yes, +2 points). |
age_years |
Numeric. Patient age in years. (< 77 years adds +2 points; >= 77 years adds 0 points). Note: Younger age in this specific older-adult cohort was associated with higher risk, potentially due to tighter glycemic control efforts. |
total_ed_visits_12mo |
Numeric. Total number of Emergency Department visits for *any* reason in the prior 12 months. 0: 0 points. 1: +1 point. >=2: +2 points. |
Value
A list containing:
Hypoglycemia_Risk_Score |
The calculated score (Range 0-17). |
Risk_Level |
Classification (Low <=1, Intermediate 2-6, High >=7). |
Est_12_Month_Risk |
Estimated percentage risk of severe hypoglycemia. |
References
Karter AJ, Warton EM, Lipska KJ, et al. Development and Validation of a Tool to Identify Patients With Type 2 Diabetes at High Risk of Hypoglycemia-Related Emergency Department or Hospital Use. JAMA Intern Med. 2017;177(10):1461-1470. doi:10.1001/jamainternmed.2017.3844
Examples
# Example 1: High Risk
# 1 prior hypo (+3), Insulin (+3), Age 70 (+2), No CKD, 0 ED visits
# Score = 3 + 3 + 2 = 8
hypoglycemia_risk_score(1, 1, 0, 0, 70, 0)
# Example 2: Low Risk
# 0 prior, No Insulin, Sulfonylurea (+3), Age 80 (0), No CKD, 0 ED visits
# Score = 3 (Intermediate - wait, check thresholds: Low 0-1, Int 2-6. So Intermediate).
hypoglycemia_risk_score(0, 0, 1, 0, 80, 0)
ICC Diagnostic Criteria for Primary Myelofibrosis (PMF)
Description
Evaluates the International Consensus Classification (ICC) diagnostic criteria for Primary Myelofibrosis (PMF). Diagnosis requires meeting all 3 Major criteria and at least 1 Minor criterion. This applies to both Prefibrotic/Early PMF and Overt PMF (though specific histologic features differ between the two, the checklist structure is shared).
Usage
icc_pmf_criteria(histology_consistent, exclusion_of_other_neoplasms,
clonal_marker_present, anemia, leukocytosis, splenomegaly,
ldh_elevated, leukoerythroblastosis)
Arguments
histology_consistent |
Numeric (0 or 1). Major Criterion: Megakaryocytic proliferation with atypia and either reticulin/collagen fibrosis (grades 2-3 for Overt) or granulocytic proliferation with decreased erythropoiesis (for Prefibrotic). (1 = Yes). |
exclusion_of_other_neoplasms |
Numeric (0 or 1). Major Criterion: Not meeting WHO/ICC criteria for CML, PV, ET, MDS, or other myeloid neoplasm. (1 = Yes). |
clonal_marker_present |
Numeric (0 or 1). Major Criterion: Presence of JAK2, CALR, or MPL mutation; OR presence of another clonal marker (e.g., ASXL1, EZH2, TET2, IDH1/IDH2, SRSF2, SF3B1); OR absence of reactive reticulin fibrosis. (1 = Yes). |
anemia |
Numeric (0 or 1). Minor Criterion: Anemia not attributed to a comorbid condition. (1 = Yes). |
leukocytosis |
Numeric (0 or 1). Minor Criterion: Leukocytosis (WBC >= 11 x 10^9/L). (1 = Yes). |
splenomegaly |
Numeric (0 or 1). Minor Criterion: Palpable splenomegaly. (1 = Yes). |
ldh_elevated |
Numeric (0 or 1). Minor Criterion: LDH level above the upper limit of normal. (1 = Yes). |
leukoerythroblastosis |
Numeric (0 or 1). Minor Criterion: Leukoerythroblastosis. (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Primary Myelofibrosis (PMF)" or "Criteria Not Met". |
Major_Criteria_Met |
Count of major criteria satisfied (Max 3). |
Minor_Criteria_Met |
Count of minor criteria satisfied. |
References
Arber DA, Orazi A, Hasserjian RP, et al. International Consensus Classification of Myeloid Neoplasms and Acute Leukemias: integrating morphologic, clinical, and genomic data. Blood. 2022;140(11):1200-1228. doi:10.1182/blood.2022015850
Examples
# Example 1: Diagnosis Met
# Histology (1), No CML/PV (1), JAK2+ (1), Anemia (1)
icc_pmf_criteria(1, 1, 1, 1, 0, 0, 0, 0)
# Example 2: Diagnosis Not Met
# Histology (1), No CML/PV (1), No Clonal Marker (0), No Minor Signs
icc_pmf_criteria(1, 1, 0, 0, 0, 0, 0, 0)
ICC Diagnostic Criteria for Systemic Mastocytosis (2022)
Description
Evaluates the International Consensus Classification (ICC) diagnostic criteria for Systemic Mastocytosis (SM). Diagnosis requires either one Major criterion + at least one Minor criterion, OR at least three Minor criteria.
Usage
icc_systemic_mastocytosis_criteria(major_criterion_multifocal_infiltrates,
minor_criterion_spindle_mast_cells,
minor_criterion_kit_mutation,
minor_criterion_cd25_expression,
minor_criterion_tryptase_gt_20,
minor_criterion_cd30_expression_bmm)
Arguments
major_criterion_multifocal_infiltrates |
Numeric (0 or 1). Multifocal dense infiltrates of mast cells (>=15 mast cells in aggregates) detected in sections of bone marrow and/or other extracutaneous organ(s). (1 = Yes). |
minor_criterion_spindle_mast_cells |
Numeric (0 or 1). >25% of all mast cells are atypical cells (type I or type II) on bone marrow smears or are spindle-shaped in mast cell infiltrates detected on sections of bone marrow or other extracutaneous organ(s). (1 = Yes). |
minor_criterion_kit_mutation |
Numeric (0 or 1). KIT D816V mutation or other activating KIT mutation detected in bone marrow, blood, or other extracutaneous organ(s). (1 = Yes). |
minor_criterion_cd25_expression |
Numeric (0 or 1). Mast cells in bone marrow, blood, or other extracutaneous organ(s) express CD25 (with or without CD2). (1 = Yes). |
minor_criterion_tryptase_gt_20 |
Numeric (0 or 1). Serum total tryptase persistently > 20 ng/mL (in absence of unrelated myeloid neoplasm). (1 = Yes). |
minor_criterion_cd30_expression_bmm |
Numeric (0 or 1). Mast cells in bone marrow display abnormal CD30 expression (Note: This is specific to Bone Marrow Mastocytosis/BMM context in some classifications, but included as a minor criterion in ICC updates for SM). (1 = Yes). *Note: MDCalc implementation often lists CD25/CD2/CD30 under the immunophenotype criterion. This function separates CD25 and CD30 if treated distinctly or groups them if standard.* |
Value
A list containing:
Diagnosis |
"Criteria Met" or "Criteria Not Met". |
Major_Criteria_Met |
Boolean indicating presence of the major criterion. |
Minor_Criteria_Count |
Count of minor criteria met. |
References
Arber DA, Orazi A, Hasserjian RP, et al. International Consensus Classification of Myeloid Neoplasms and Acute Leukemias: integrating morphologic, clinical, and genomic data. Blood. 2022;140(11):1200-1228. doi:10.1182/blood.2022015850
Examples
# Example 1: Diagnosis Met (1 Major + 1 Minor)
# Major infiltrates (1), KIT mutation (1)
icc_systemic_mastocytosis_criteria(1, 0, 1, 0, 0, 0)
# Example 2: Diagnosis Met (3 Minor)
# No Major, Spindle cells (1), KIT mutation (1), CD25 (1)
icc_systemic_mastocytosis_criteria(0, 1, 1, 1, 0, 0)
Intracerebral Hemorrhage (ICH) Score
Description
Calculates the ICH Score to estimate 30-day mortality in patients with spontaneous intracerebral hemorrhage. The score is a simple clinical grading scale ranging from 0 to 6, derived from the Glasgow Coma Scale (GCS), ICH volume, presence of intraventricular hemorrhage (IVH), infratentorial origin, and age.
Usage
ich_score(gcs_score, ich_volume_cm3, intraventricular_hemorrhage,
infratentorial_origin, age_years)
Arguments
gcs_score |
Numeric. Glasgow Coma Scale score on admission (3-15). 3-4: +2 pts. 5-12: +1 pt. 13-15: 0 pts. |
ich_volume_cm3 |
Numeric. Volume of the hematoma in cubic centimeters. (>= 30 cm3 adds 1 point). |
intraventricular_hemorrhage |
Numeric (0 or 1). Presence of intraventricular hemorrhage. (1 = Yes, +1 point). |
infratentorial_origin |
Numeric (0 or 1). Is the hemorrhage infratentorial in origin (e.g., brainstem, cerebellum)? (1 = Yes, +1 point). |
age_years |
Numeric. Patient age in years. (>= 80 years adds 1 point). |
Value
A list containing:
ICH_Score |
The calculated total score (Range 0-6). |
Est_30_Day_Mortality |
Estimated 30-day mortality percentage based on the derivation cohort. |
References
Hemphill JC 3rd, Bonovich DC, Besmertis L, Manley GT, Johnston SC. The ICH score: a simple, reliable grading scale for intracerebral hemorrhage. Stroke. 2001;32(4):891-897. doi:10.1161/01.str.32.4.891
Examples
# Example 1: High Mortality
# GCS 4 (+2), Vol 40 (+1), IVH Yes (+1), Infratentorial Yes (+1), Age 85 (+1)
# Score = 6
ich_score(4, 40, 1, 1, 85)
# Example 2: Low Mortality
# GCS 15 (0), Vol 10 (0), No IVH (0), Supratentorial (0), Age 60 (0)
# Score = 0
ich_score(15, 10, 0, 0, 60)
IDF-DAR Fasting Risk Assessment for Ramadan
Description
Calculates the risk score for patients with diabetes who intend to fast during Ramadan, based on the International Diabetes Federation (IDF) and Diabetes and Ramadan (DAR) International Alliance guidelines (2021). The score stratifies patients into Low, Moderate, and High risk categories.
Usage
idf_dar_fasting_risk(type_1_diabetes, duration_gt_10_years, hba1c_value,
hypoglycemia_points, complication_points, medication_points,
smbg_not_performed, pregnancy, frailty_cognitive,
intense_labor, previous_ramadan_bad)
Arguments
type_1_diabetes |
Numeric (0 or 1). Is the patient Type 1? (1 = Yes, +1 point). |
duration_gt_10_years |
Numeric (0 or 1). Is the duration of diabetes > 10 years? (1 = Yes, +1 point). |
hba1c_value |
Numeric. Current HbA1c percentage. (7.5-9.0: +1 pt; >9.0: +2 pts). |
hypoglycemia_points |
Numeric. Points based on hypoglycemia history: 0: None/Stable. 1: Hypo occurring but stable/aware. 5.5: Recent severe hypoglycemia, hypoglycemia unawareness, or DKA/HHS within 3 months. |
complication_points |
Numeric. Sum of points for complications: 0: None. 2: Stable cardiovascular disease. 4: Unstable CVD, Heart Failure, Stroke. 4: Renal impairment eGFR 30-60. 5.5: eGFR < 30 or Dialysis. |
medication_points |
Numeric. Sum of points for medications used: 0: Metformin, TZD, GLP-1, DPP-4. 0.5: Sulfonylurea (2nd gen), SGLT2 inhibitors (monitor DKA). 1: Glibenclamide (long-acting SU). 1.5: Basal insulin. 2.0: Premix insulin (once daily). 3.0: Multiple dose insulin (MDI) or Pump. |
smbg_not_performed |
Numeric (0 or 1). Self-monitoring of blood glucose (SMBG) is NOT performed? (1 = Yes, +2 points). |
pregnancy |
Numeric (0 or 1). Is the patient pregnant? (1 = Yes, +6.5 points). |
frailty_cognitive |
Numeric (0 or 1). Frailty, cognitive impairment, or living alone without support? (1 = Yes, +5.5 points). |
intense_labor |
Numeric (0 or 1). Does the patient perform intense physical labor? (1 = Yes, +1 point). |
previous_ramadan_bad |
Numeric (0 or 1). Previous negative experience (e.g., admission, severe hypo) during Ramadan? (1 = Yes, +1 point). |
Value
A list containing:
Total_Risk_Score |
The calculated risk score. |
Risk_Category |
Classification (Low <=3, Moderate 3.5-6, High >6). |
Recommendation |
Guidance on fasting safety. |
References
International Diabetes Federation and the DAR International Alliance. Diabetes and Ramadan: Practical Guidelines, 2021.
Examples
# Example 1: Low Risk T2DM
# T2 (0), <10y (0), A1c 7.0 (0), No Hypo (0), No Comps (0), Metformin (0)
idf_dar_fasting_risk(0, 0, 7.0, 0, 0, 0, 0, 0, 0, 0, 0)
# Example 2: High Risk T1DM
# T1 (1), >10y (1), A1c 9.5 (2), MDI (3), Recent Hypo (5.5)
# Score = 12.5
idf_dar_fasting_risk(1, 1, 9.5, 5.5, 0, 3, 0, 0, 0, 0, 0)
Infective Endocarditis (IE) Mortality Risk Score
Description
Calculates the 6-month mortality risk score for patients with active Infective Endocarditis (IE). Derived from the International Collaboration on Endocarditis (ICE) database, this tool stratifies patients into risk categories based on host factors, disease characteristics, and complications.
Usage
ie_mortality_risk_score(age, severe_heart_failure, microorganism,
paravalvular_complication, dialysis, prosthetic_valve)
Arguments
age |
Numeric. Patient age in years. <45: 0 pts. 45-54: 3 pts. 55-64: 5 pts. 65-74: 7 pts. >=75: 9 pts. |
severe_heart_failure |
Numeric (0 or 1). Presence of severe heart failure (NYHA Class III or IV). (1 = Yes, +5 pts). |
microorganism |
String. Causative organism. "viridans_streptococci": 0 pts. "staphylococcus_aureus": +5 pts. "other": +2 pts. |
paravalvular_complication |
Numeric (0 or 1). Presence of paravalvular complications (e.g., abscess, fistula). (1 = Yes, +4 pts). |
dialysis |
Numeric (0 or 1). Patient is on dialysis. (1 = Yes, +4 pts). |
prosthetic_valve |
Numeric (0 or 1). Presence of a prosthetic valve. (1 = Yes, +4 pts). |
Value
A list containing:
IE_Mortality_Score |
The calculated risk score (Range 0-31+). |
Risk_Category |
Classification (Low <=6, Intermediate 7-14, High >=15). |
Est_6_Month_Mortality |
Estimated percentage probability of mortality within 6 months. |
References
Park LP, Chu VH, Peterson G, et al. A validated model for predicting 6-month mortality in infective endocarditis. Eur Heart J. 2016;37(30):2394-2404. doi:10.1093/eurheartj/ehv593
Examples
# Example 1: High Risk
# 70yo (+7), S. aureus (+5), Dialysis (+4)
# Score = 16
ie_mortality_risk_score(70, 0, "staphylococcus_aureus", 0, 1, 0)
# Example 2: Low Risk
# 40yo (0), Viridans Strep (0), No complications
# Score = 0
ie_mortality_risk_score(40, 0, "viridans_streptococci", 0, 0, 0)
IMDC (Heng) Risk Model for Metastatic Renal Cell Carcinoma
Description
Calculates the International Metastatic Renal Cell Carcinoma Database Consortium (IMDC) risk score. This prognostic model stratifies patients with metastatic renal cell carcinoma (mRCC) treated with targeted therapy (VEGF-targeted agents) into Favorable, Intermediate, or Poor risk groups based on six clinical factors.
Usage
imdc_risk_score(time_to_therapy_lt_1yr, kps_lt_80, hemoglobin_lt_lln,
calcium_gt_uln, neutrophils_gt_uln, platelets_gt_uln)
Arguments
time_to_therapy_lt_1yr |
Numeric (0 or 1). Less than 1 year from the time of diagnosis to the start of systemic therapy. (1 = Yes). |
kps_lt_80 |
Numeric (0 or 1). Karnofsky Performance Status < 80%. (1 = Yes). |
hemoglobin_lt_lln |
Numeric (0 or 1). Hemoglobin less than the Lower Limit of Normal (LLN). (1 = Yes). |
calcium_gt_uln |
Numeric (0 or 1). Corrected Calcium greater than the Upper Limit of Normal (ULN). (1 = Yes). |
neutrophils_gt_uln |
Numeric (0 or 1). Neutrophil count greater than the Upper Limit of Normal (ULN). (1 = Yes). |
platelets_gt_uln |
Numeric (0 or 1). Platelet count greater than the Upper Limit of Normal (ULN). (1 = Yes). |
Value
A list containing:
IMDC_Score |
The calculated total count of risk factors (Range 0-6). |
Risk_Group |
Classification (Favorable: 0, Intermediate: 1-2, Poor: >=3). |
Median_Overall_Survival |
Estimated median overall survival based on the original validation cohort. |
References
Heng DY, Xie W, Regan MM, et al. Prognostic factors for overall survival in patients with metastatic renal cell carcinoma treated with vascular endothelial growth factor-targeted agents: results from a large, multicenter study. J Clin Oncol. 2009;27(34):5794-5799. doi:10.1200/JCO.2008.21.4809
Examples
# Example 1: Poor Risk
# <1yr to tx, Low KPS, Anemia
# Score = 3
imdc_risk_score(1, 1, 1, 0, 0, 0)
# Example 2: Favorable Risk
# No risk factors present
# Score = 0
imdc_risk_score(0, 0, 0, 0, 0, 0)
CDC Childhood Immunization Schedule
Description
Generates a list of recommended vaccines based on the child's current age in months, following the standard CDC immunization schedule (birth through 18 years). This function assumes the child is on track with previous doses.
Usage
immunization_schedule_cdc(current_age_months)
Arguments
current_age_months |
Numeric. The age of the patient in months. |
Value
A list containing:
Age_Months |
Input age. |
Recommended_Vaccines |
A vector of strings listing the vaccines typically administered at this specific age visit. |
References
Centers for Disease Control and Prevention (CDC). Recommended Child and Adolescent Immunization Schedule for ages 18 years or younger, United States, 2024.
Examples
# Example 1: 2 Month Visit
immunization_schedule_cdc(2)
# Example 2: 1 Year Visit (12 months)
immunization_schedule_cdc(12)
# Example 3: 11 Year Visit (132 months)
immunization_schedule_cdc(132)
IMPACT Score for Head Injury Outcomes
Description
Calculates the predicted 6-month probability of mortality and unfavorable outcome (Death, Vegetative State, or Severe Disability) in patients with moderate to severe Traumatic Brain Injury (TBI). This function implements the Extended Model (Clinical + CT findings) and optionally the Lab Model if glucose and hemoglobin are provided.
Usage
impact_head_injury_prognosis(age, motor_score, pupils_reactive, ct_marshall_class,
tsah_present, epidural_mass_present,
glucose_mg_dl = NULL, hemoglobin_g_dl = NULL)
Arguments
age |
Numeric. Patient age in years. |
motor_score |
Numeric (1-6). Glasgow Coma Scale Motor Score. 1: None. 2: Extension. 3: Flexion (Abnormal). 4: Withdrawal. 5: Localizes. 6: Obeys. |
pupils_reactive |
Numeric (0, 1, or 2). Number of pupils reactive to light. |
ct_marshall_class |
Numeric (1-6). Marshall CT Classification. 1: Diffuse Injury I (No visible pathology). 2: Diffuse Injury II (Cisterns present, shift < 5mm, no high density > 25cc). 3: Diffuse Injury III (Cisterns compressed/absent, shift < 5mm, no high density > 25cc). 4: Diffuse Injury IV (Midline shift > 5mm, no high density > 25cc). 5: Evacuated Mass Lesion V. 6: Non-Evacuated Mass Lesion VI (> 25cc, not evacuated). |
tsah_present |
Numeric (0 or 1). Traumatic Subarachnoid Hemorrhage on CT? (1 = Yes). |
epidural_mass_present |
Numeric (0 or 1). Epidural Hematoma on CT? (1 = Yes). Note: Epidural hematomas are often associated with better outcomes compared to other lesions in this model. |
glucose_mg_dl |
Numeric (Optional). Admission serum glucose in mg/dL. |
hemoglobin_g_dl |
Numeric (Optional). Admission hemoglobin in g/dL. |
Value
A list containing:
Predicted_6mo_Mortality |
The estimated probability of death at 6 months. |
Predicted_6mo_Unfavorable_Outcome |
The estimated probability of an unfavorable outcome (GOSE 1-4) at 6 months. |
Definitions |
Definitions of outcomes. |
References
Steyerberg EW, Mushkudiani N, Perel P, et al. Predicting outcome after traumatic brain injury: development and international validation of prognostic scores based on admission characteristics. PLoS Med. 2008;5(8):e165. doi:10.1371/journal.pmed.0050165
Examples
# Example 1: Poor Prognosis
# 70yo, Motor 2, 0 Pupils, Marshall VI (Non-evac mass), tSAH, No Epidural
impact_head_injury_prognosis(70, 2, 0, 6, 1, 0)
# Example 2: Better Prognosis
# 25yo, Motor 5, 2 Pupils, Marshall II, No tSAH, Epidural present
impact_head_injury_prognosis(25, 5, 2, 2, 0, 1)
IMPEDE VTE Score for Multiple Myeloma
Description
Calculates the IMPEDE VTE score to predict the 6-month risk of venous thromboembolism in patients with Multiple Myeloma. This tool stratifies patients into Low, Intermediate, and High risk categories, incorporating both risk factors (e.g., IMiDs, history of VTE) and protective factors (e.g., infection, low BMI).
Usage
impede_vte_score(infection, bmi_lt_25, steroid_use, pe_history, dvt_history,
erythropoietin_agent, doxorubicin_regimen,
existing_central_catheter, thalidomide_analog,
enzalutamide_abiraterone)
Arguments
infection |
Numeric (0 or 1). Serious infection (requiring hospitalization) within prior 3 months. (1 = Yes, -3 points). |
bmi_lt_25 |
Numeric (0 or 1). Body Mass Index < 25 kg/m^2. (1 = Yes, -1 point). |
steroid_use |
Numeric (0 or 1). Use of Dexamethasone or Prednisone. (1 = Yes, +1 point). |
pe_history |
Numeric (0 or 1). History of Pulmonary Embolism. (1 = Yes, +3 points). |
dvt_history |
Numeric (0 or 1). History of Deep Vein Thrombosis. (1 = Yes, +2 points). |
erythropoietin_agent |
Numeric (0 or 1). Use of Erythropoiesis-Stimulating Agents. (1 = Yes, +3 points). |
doxorubicin_regimen |
Numeric (0 or 1). Use of Doxorubicin or Pegylated Doxorubicin. (1 = Yes, +2 points). |
existing_central_catheter |
Numeric (0 or 1). Presence of existing Central Venous Catheter or PICC. (1 = Yes, +3 points). |
thalidomide_analog |
Numeric (0 or 1). Use of Thalidomide, Lenalidomide, or Pomalidomide (IMiDs). (1 = Yes, +3 points). |
enzalutamide_abiraterone |
Numeric (0 or 1). Note: While the tool includes this variable for general context or future adaptation, in standard IMPEDE for MM, this specific variable might not be part of the core 9-factor derivation in all versions, but it is often included in broader oncologic VTE models. For strict IMPEDE MM calculation, verify if this is a core component or an addition. MDCalc includes 10 items. Assuming +3 points based on typical high-risk medication weighting if included. |
Value
A list containing:
IMPEDE_Score |
The calculated total score. |
Risk_Category |
Classification (Low <= 1, Intermediate 2-5, High >= 6). |
Six_Month_VTE_Risk |
Estimated percentage risk of VTE at 6 months. |
References
Sanfilippo KM, Luo S, Wang TF, et al. Predicting Venous Thromboembolism in Multiple Myeloma: Development and Validation of the IMPEDE VTE Score. Am J Hematol. 2019;94(11):1176-1184. doi:10.1002/ajh.25603
Examples
# Example 1: High Risk
# Hx PE (+3), IMiD (+3), Steroids (+1)
# Score = 7
impede_vte_score(0, 0, 1, 1, 0, 0, 0, 0, 1, 0)
# Example 2: Low Risk
# Low BMI (-1), Recent Infection (-3), Steroids (+1)
# Score = -3
impede_vte_score(1, 1, 1, 0, 0, 0, 0, 0, 0, 0)
IMPROVE Bleeding Risk Score
Description
Calculates the IMPROVE Bleeding Risk Score to estimate the probability of major or clinically relevant non-major bleeding within 14 days of hospital admission in acutely ill medical patients. This score helps balance the risk of bleeding against the benefit of VTE prophylaxis.
Usage
improve_bleeding_risk_score(age, sex, gfr, active_cancer, rheumatic_disease,
central_venous_catheter, icu_ccu_admission,
hepatic_failure_inr_gt_1_5, platelet_count_lt_50,
prior_bleeding_3mo, active_gastroduodenal_ulcer)
Arguments
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). |
gfr |
Numeric. Glomerular Filtration Rate (mL/min/1.73m^2). |
active_cancer |
Numeric (0 or 1). Active malignancy (excluding non-melanoma skin cancer) diagnosed or treated within the last 6 months. |
rheumatic_disease |
Numeric (0 or 1). History of rheumatic disease (e.g., RA, SLE). |
central_venous_catheter |
Numeric (0 or 1). Presence of a central venous catheter. |
icu_ccu_admission |
Numeric (0 or 1). Admission to an Intensive Care Unit (ICU) or Coronary Care Unit (CCU). |
hepatic_failure_inr_gt_1_5 |
Numeric (0 or 1). Liver failure defined as INR > 1.5. |
platelet_count_lt_50 |
Numeric (0 or 1). Thrombocytopenia (Platelet count < 50 x 10^9/L). |
prior_bleeding_3mo |
Numeric (0 or 1). Bleeding event within the 3 months prior to admission. |
active_gastroduodenal_ulcer |
Numeric (0 or 1). Active gastroduodenal ulcer. |
Details
Scoring Weights: Active Gastroduodenal Ulcer: +4.5 Prior Bleeding (<3mo): +4.0 Platelets < 50k: +4.0 Age >= 85: +3.5 Hepatic Failure (INR>1.5): +2.5 GFR < 30: +2.5 ICU/CCU: +2.5 CVC: +2.0 Rheumatic Disease: +2.0 Active Cancer: +2.0 Age 40-84: +1.5 Male Sex: +1.0 GFR 30-59: +1.0
Value
A list containing:
IMPROVE_Bleeding_Score |
The calculated total score (Range 0-30.5+). |
Risk_Category |
Classification (Low < 7, High >= 7). |
Bleeding_Probability_14_Days |
Estimated probability of any bleeding event within 14 days. |
References
Decousus H, Tapson VF, Bergmann JF, et al. Factors at admission associated with bleeding risk in medical patients: findings from the IMPROVE investigators. Chest. 2011;139(1):69-79. doi:10.1378/chest.09-3081
Examples
# Example 1: High Risk
# Ulcer (+4.5), Male (+1.0), Age 45 (+1.5), GFR 40 (+1.0)
# Score = 8.0
improve_bleeding_risk_score(45, "male", 40, 0, 0, 0, 0, 0, 0, 0, 1)
# Example 2: Low Risk
# Female, Age 30, No risk factors
# Score = 0
improve_bleeding_risk_score(30, "female", 90, 0, 0, 0, 0, 0, 0, 0, 0)
IMPROVE Risk Score for Venous Thromboembolism (VTE)
Description
Calculates the IMPROVE VTE Risk Score to predict the 3-month risk of symptomatic VTE in acutely ill hospitalized medical patients. The score helps identify patients who may benefit from thromboprophylaxis.
Usage
improve_vte_risk_score(previous_vte, known_thrombophilia, lower_limb_paralysis,
current_cancer, immobilized_ge_7days, icu_ccu_stay,
age_gt_60)
Arguments
previous_vte |
Numeric (0 or 1). History of previous VTE. (1 = Yes, +3 points). |
known_thrombophilia |
Numeric (0 or 1). Known thrombophilia (congenital or acquired). (1 = Yes, +2 points). |
lower_limb_paralysis |
Numeric (0 or 1). Current lower-limb paralysis or paresis. (1 = Yes, +2 points). |
current_cancer |
Numeric (0 or 1). Active cancer (excluding non-melanoma skin cancer). (1 = Yes, +2 points). |
immobilized_ge_7days |
Numeric (0 or 1). Immobilization for >= 7 days immediately prior to and during admission. (1 = Yes, +1 point). |
icu_ccu_stay |
Numeric (0 or 1). Stay in an Intensive Care Unit (ICU) or Coronary Care Unit (CCU). (1 = Yes, +1 point). |
age_gt_60 |
Numeric (0 or 1). Age > 60 years. (1 = Yes, +1 point). |
Value
A list containing:
IMPROVE_VTE_Score |
The calculated risk score (Range 0-12). |
Est_3_Month_VTE_Risk |
Estimated percentage risk of symptomatic VTE at 3 months. |
Recommendation |
Clinical guidance regarding prophylaxis. |
References
Spyropoulos AC, Anderson FA Jr, FitzGerald G, et al. Predictive and associative models to identify hospitalized medical patients at risk for VTE. Chest. 2011;140(3):706-714. doi:10.1378/chest.10-1944
Examples
# Example 1: High Risk
# Prior VTE (+3), Cancer (+2), Age >60 (+1)
# Score = 6
improve_vte_risk_score(1, 0, 0, 1, 0, 0, 1)
# Example 2: Low Risk
# Age >60 only
# Score = 1
improve_vte_risk_score(0, 0, 0, 0, 0, 0, 1)
IMPROVEDD VTE Risk Score
Description
Calculates the IMPROVEDD (IMPROVE + D-Dimer) VTE Risk Score. This tool enhances the original IMPROVE score by adding elevated D-dimer as a weighted risk factor, improving the identification of hospitalized medical patients at high risk for venous thromboembolism (VTE).
Usage
improvedd_vte_score(previous_vte, known_thrombophilia, lower_limb_paralysis,
current_cancer, immobilized_ge_7days, icu_ccu_stay,
age_gt_60, d_dimer_ge_2x_uln)
Arguments
previous_vte |
Numeric (0 or 1). History of previous VTE. (1 = Yes, +3 points). |
known_thrombophilia |
Numeric (0 or 1). Known thrombophilia. (1 = Yes, +2 points). |
lower_limb_paralysis |
Numeric (0 or 1). Current lower-limb paralysis or paresis. (1 = Yes, +2 points). |
current_cancer |
Numeric (0 or 1). Active cancer. (1 = Yes, +2 points). |
immobilized_ge_7days |
Numeric (0 or 1). Immobilization >= 7 days. (1 = Yes, +1 point). |
icu_ccu_stay |
Numeric (0 or 1). Stay in ICU or CCU. (1 = Yes, +1 point). |
age_gt_60 |
Numeric (0 or 1). Age > 60 years. (1 = Yes, +1 point). |
d_dimer_ge_2x_uln |
Numeric (0 or 1). D-dimer level >= 2 times the Upper Limit of Normal (ULN). (1 = Yes, +2 points). |
Value
A list containing:
IMPROVEDD_Score |
The calculated score (Range 0-14). |
Risk_Category |
Classification (Low 0-1, Moderate 2-3, High >=4). |
VTE_Risk_42_Day |
Estimated 42-day VTE risk percentage. |
References
Gibson CM, Spyropoulos AC, Cohen AT, et al. The IMPROVEDD VTE Risk Score: A New Model for Predicting Venous Thromboembolism in Acutely Ill Hospitalized Medical Patients. TH Open. 2017;1(1):e56-e65. doi:10.1055/s-0037-1604432
Examples
# Example 1: High Risk
# Prior VTE (+3), D-Dimer High (+2)
# Score = 5
improvedd_vte_score(1, 0, 0, 0, 0, 0, 0, 1)
# Example 2: Moderate Risk
# Age >60 (+1), Immobilized (+1)
# Score = 2
improvedd_vte_score(0, 0, 0, 0, 1, 0, 1, 0)
Infant Scalp Score
Description
Calculates the Infant Scalp Score (Greenes & Schutzman) to stratify the risk of traumatic brain injury (TBI) in infants (<2 years) with isolated scalp hematomas. The score helps guide the decision between observation and neuroimaging (CT).
Usage
infant_scalp_score(age_months, hematoma_size, hematoma_location)
Arguments
age_months |
Numeric. Patient age in months. 0-2 mo: +3 pts. 3-5 mo: +2 pts. 6-11 mo: +1 pt. >=12 mo: 0 pts. |
hematoma_size |
String. Size/Character of the hematoma. "none": No hematoma (0 pts). "small": Barely palpable / <1 cm (1 pt). "medium": Easily palpable / 1-3 cm (2 pts). "large": Boggy / >3 cm (3 pts). |
hematoma_location |
String. Location of the hematoma. "frontal": 0 pts. "occipital": 1 pt. "parietal_temporal": 2 pts. |
Value
A list containing:
Infant_Scalp_Score |
The calculated risk score (Range 0-8). |
Risk_Category |
"Low Risk" (Score < 4) or "High Risk" (Score >= 4). |
Recommendation |
Guidance on the need for head CT. |
References
Greenes DS, Schutzman SA. Clinical indicators of intracranial injury in head-injured infants. Pediatrics. 1999;104(4 Pt 1):861-867. doi:10.1542/peds.104.4.861
Examples
# Example 1: High Risk
# 2 month old (+3), Small hematoma (+1), Parietal (+2)
# Score = 6
infant_scalp_score(2, "small", "parietal_temporal")
# Example 2: Low Risk
# 9 month old (+1), Medium hematoma (+2), Frontal (0)
# Score = 3
infant_scalp_score(9, "medium", "frontal")
Injury Severity Score (ISS)
Description
Calculates the Injury Severity Score (ISS) based on the Abbreviated Injury Scale (AIS). The ISS is an anatomical scoring system that provides an overall score for patients with multiple injuries. It is calculated as the sum of the squares of the highest AIS code in each of the three most severely injured body regions.
Usage
injury_severity_score(head_neck_ais, face_ais, chest_ais, abdomen_pelvis_ais,
extremities_pelvic_girdle_ais, external_ais)
Arguments
head_neck_ais |
Numeric (0-6). Highest AIS severity code for the Head or Neck region. |
face_ais |
Numeric (0-6). Highest AIS severity code for the Face region. |
chest_ais |
Numeric (0-6). Highest AIS severity code for the Chest region. |
abdomen_pelvis_ais |
Numeric (0-6). Highest AIS severity code for the Abdominal or Pelvic contents region. |
extremities_pelvic_girdle_ais |
Numeric (0-6). Highest AIS severity code for the Extremities or Pelvic Girdle region. |
external_ais |
Numeric (0-6). Highest AIS severity code for External injuries. |
Details
AIS Severity Codes: 1: Minor 2: Moderate 3: Serious 4: Severe 5: Critical 6: Maximal (Unsurvivable)
If any region has an AIS score of 6, the ISS is automatically assigned as 75.
Value
A list containing:
ISS_Score |
The calculated score (Range 1-75). |
Classification |
Trauma severity classification (Minor <9, Moderate 9-15, Serious 16-24, Severe >24). |
References
Baker SP, O'Neill B, Haddon W Jr, Long WB. The injury severity score: a method for describing patients with multiple injuries and evaluating emergency care. J Trauma. 1974;14(3):187-196.
Examples
# Example 1: Major Trauma
# Head 4, Chest 3, Abdomen 2, others 0
# Score = 4^2 + 3^2 + 2^2 = 16 + 9 + 4 = 29
injury_severity_score(4, 0, 3, 2, 0, 0)
# Example 2: Automatic 75
# Head 6 (Unsurvivable)
# Score = 75
injury_severity_score(6, 2, 2, 0, 0, 0)
INTERCHEST Clinical Prediction Rule for Chest Pain in Primary Care
Description
Calculates the INTERCHEST score to assess the risk of unstable coronary artery disease (UCAD) in primary care patients presenting with chest pain. The score uses simple history and physical exam findings to stratify patients into low and high risk groups for urgent referral.
Usage
interchest_score(history_cad, age_risk, effort_pain, palpation_pain,
physician_suspicion, pressure_discomfort)
Arguments
history_cad |
Numeric (0 or 1). History of coronary artery disease (MI, PCI, CABG). (1 = Yes, +1 point). |
age_risk |
Numeric (0 or 1). Age threshold (Female >= 65, Male >= 55 years). (1 = Yes, +1 point). |
effort_pain |
Numeric (0 or 1). Chest pain related to effort. (1 = Yes, +1 point). |
palpation_pain |
Numeric (0 or 1). Pain reproducible by palpation. (1 = Yes, -1 point). |
physician_suspicion |
Numeric (0 or 1). Physician initially suspected a serious condition. (1 = Yes, +1 point). |
pressure_discomfort |
Numeric (0 or 1). Chest discomfort feels like "pressure" (rather than sharp/stabbing). (1 = Yes, +1 point). |
Value
A list containing:
INTERCHEST_Score |
The calculated total score (Range -1 to 5). |
Risk_Category |
Classification (Very Low <= 1, Low 2, High >= 3). |
Recommendation |
Guidance on urgent vs. non-urgent follow-up. |
References
Alghamdi A, Alghamdi R, Oliver G, et al. Enhanced triage for chest pain in primary care: a prediction rule for unstable coronary artery disease. Eur J Emerg Med. 2019;26(4):269-275. doi:10.1097/MEJ.0000000000000574
Examples
# Example 1: Very Low Risk
# Pain reproducible by palpation only
# Score = -1
interchest_score(0, 0, 0, 1, 0, 0)
# Example 2: High Risk
# Hx CAD (+1), Effort pain (+1), MD Suspicion (+1)
# Score = 3
interchest_score(1, 0, 1, 0, 1, 0)
International IgA Nephropathy Prediction Tool
Description
Calculates the linear predictor for the risk of disease progression (50% decline in eGFR or ESRD) in patients with IgA Nephropathy at the time of biopsy. The model incorporates clinical data (eGFR, MAP, Proteinuria, Age, Race, Medications) and histologic findings (Oxford MEST score).
Usage
international_iga_nephropathy_prediction(age_at_biopsy, egfr_at_biopsy,
proteinuria_g_day, map_mmhg, race,
mest_m, mest_e, mest_s, mest_t,
use_rasb, use_immunosuppression)
Arguments
age_at_biopsy |
Numeric. Age in years at the time of biopsy. |
egfr_at_biopsy |
Numeric. eGFR (mL/min/1.73m^2) at the time of biopsy. |
proteinuria_g_day |
Numeric. Urine protein excretion (g/day). |
map_mmhg |
Numeric. Mean Arterial Pressure (mmHg). |
race |
String. Patient race: "white", "chinese", "japanese", "other". |
mest_m |
Numeric (0 or 1). Mesangial hypercellularity (M0/M1). |
mest_e |
Numeric (0 or 1). Endocapillary hypercellularity (E0/E1). |
mest_s |
Numeric (0 or 1). Segmental glomerulosclerosis (S0/S1). |
mest_t |
Numeric (0, 1, or 2). Tubular atrophy/interstitial fibrosis (T0/T1/T2). |
use_rasb |
Numeric (0 or 1). Use of Renin-Angiotensin System Blockers at/before biopsy. (1 = Yes). |
use_immunosuppression |
Numeric (0 or 1). Use of Immunosuppression at/before biopsy. (1 = Yes). |
Value
A list containing:
Linear_Predictor |
The calculated linear risk score. Higher values indicate higher risk. |
References
Barbour SJ, Coppo R, Zhang H, et al. Evaluating a New International Risk-Prediction Tool in IgA Nephropathy. JAMA Intern Med. 2019;179(7):942-952. doi:10.1001/jamainternmed.2019.0600
Examples
# Example 1: High Risk
# 30yo, eGFR 45, Protein 2.5g, MAP 105, M1 E1 S1 T2, No meds, White
international_iga_nephropathy_prediction(30, 45, 2.5, 105, "white", 1, 1, 1, 2, 0, 0)
# Example 2: Low Risk
# 40yo, eGFR 90, Protein 0.5g, MAP 90, M0 E0 S0 T0, RASB Yes, Chinese
international_iga_nephropathy_prediction(40, 90, 0.5, 90, "chinese", 0, 0, 0, 0, 1, 0)
Intraoperative Fluid Dosing for Adult Patients
Description
Calculates the recommended intraoperative fluid dosing for adult patients (>= 20 kg) based on the standard 4-2-1 rule for maintenance, NPO deficit replacement (50/25/25 rule), and third-space losses estimated by surgical trauma severity.
Usage
intraoperative_fluid_dosing(weight_kg, npo_time_hours, trauma_severity)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. |
npo_time_hours |
Numeric. Time spent NPO (nothing by mouth) in hours prior to surgery. |
trauma_severity |
String. Estimated severity of surgical trauma. Options: "minimal" (e.g., hernia), "moderate" (e.g., cholecystectomy), "severe" (e.g., bowel resection). Note: Minimal is calculated at 2 mL/kg/hr, Moderate at 4 mL/kg/hr, and Severe at 6 mL/kg/hr for third-space losses. |
Value
A list containing:
Maintenance_Rate_mL_hr |
The calculated hourly maintenance fluid rate. |
Fluid_Deficit_Total_mL |
The total fluid deficit accumulated during NPO time. |
Third_Space_Loss_mL_hr |
The estimated hourly fluid loss due to surgical trauma/third-spacing. |
Hourly_Rates |
A list of recommended infusion rates (mL/hr) for the 1st, 2nd, 3rd, and subsequent hours of surgery. |
References
Holliday MA, Segar WE. The maintenance need for water in parenteral fluid therapy. Pediatrics. 1957;19(5):823-832. Miller RD. Miller's Anesthesia. 8th ed. Philadelphia, PA: Elsevier Saunders; 2015.
Examples
# Example 1: 70kg patient, NPO 8 hours, Moderate Trauma
# Maintenance: 40 + 20 + 50 = 110 mL/hr
# Deficit: 110 * 8 = 880 mL
# Third Space: 4 * 70 = 280 mL/hr
# Hour 1: 110 + 440 + 280 = 830 mL/hr
intraoperative_fluid_dosing(70, 8, "moderate")
# Example 2: 100kg patient, NPO 10 hours, Severe Trauma
intraoperative_fluid_dosing(100, 10, "severe")
Intrauterine RBC Transfusion Dosage
Description
Calculates the volume of donor red blood cells (RBC) required for an intrauterine transfusion to treat fetal anemia. The calculation estimates the feto-placental blood volume based on fetal weight and uses the hematocrit difference to determine the necessary volume.
Usage
intrauterine_rbc_transfusion(fetal_weight_grams, current_hematocrit,
target_hematocrit, donor_hematocrit = 80)
Arguments
fetal_weight_grams |
Numeric. Estimated fetal weight in grams. |
current_hematocrit |
Numeric. Current fetal hematocrit (pre-transfusion) percentage. |
target_hematocrit |
Numeric. Desired post-transfusion hematocrit percentage (typically 40-50%). |
donor_hematocrit |
Numeric. Hematocrit of the donor RBC unit. Defaults to 80% (typical for packed RBCs prepared for IUT). |
Details
Formula:
Volume_{transfuse} = V_{feto-placental} \times \frac{Hct_{target} - Hct_{current}}{Hct_{donor} - Hct_{current}}
Where V_{feto-placental} is estimated as Weight_{fetal} \times 0.14.
Value
A list containing:
Volume_to_Transfuse_mL |
The calculated volume of donor blood to administer. |
Estimated_FetoPlacental_Volume_mL |
The estimated total blood volume of the fetus and placenta. |
References
Mandelbrot L, Daffos F, Forestier F, et al. Assessment of fetal blood volume for computer-assisted management of in utero transfusion. Fetal Diagn Ther. 1988;3(1):60-66. doi:10.1159/000263338
Examples
# Example 1: Severe Anemia
# 1000g fetus, Hct 20 -> 45, Donor Hct 80
intrauterine_rbc_transfusion(1000, 20, 45, 80)
# Example 2: Moderate Anemia
# 1500g fetus, Hct 30 -> 45, Donor Hct 75
intrauterine_rbc_transfusion(1500, 30, 45, 75)
IOTA Simple Rules Risk Assessment for Ovarian Tumors
Description
Calculates the estimated risk of malignancy for adnexal masses using the International Ovarian Tumor Analysis (IOTA) Simple Rules Risk (SRR) model. This model applies a logistic regression to the 10 standard IOTA Simple Rules features to provide a specific probability of malignancy, even when the standard rules classification is "Inconclusive".
Usage
iota_simple_rules_risk(b1_unilocular, b2_solid_lt_7mm, b3_acoustic_shadows,
b4_smooth_multi_lt_100mm, b5_no_blood_flow,
m1_irregular_solid, m2_ascites, m3_four_papillary_structures,
m4_irregular_multi_gt_100mm, m5_strong_blood_flow)
Arguments
b1_unilocular |
Numeric (0 or 1). B1: Unilocular cyst. (1 = Yes). |
b2_solid_lt_7mm |
Numeric (0 or 1). B2: Presence of solid components with largest diameter < 7 mm. (1 = Yes). |
b3_acoustic_shadows |
Numeric (0 or 1). B3: Presence of acoustic shadows. (1 = Yes). |
b4_smooth_multi_lt_100mm |
Numeric (0 or 1). B4: Smooth multilocular tumor with largest diameter < 100 mm. (1 = Yes). |
b5_no_blood_flow |
Numeric (0 or 1). B5: No blood flow (Color score 1). (1 = Yes). |
m1_irregular_solid |
Numeric (0 or 1). M1: Irregular solid tumor. (1 = Yes). |
m2_ascites |
Numeric (0 or 1). M2: Presence of ascites. (1 = Yes). |
m3_four_papillary_structures |
Numeric (0 or 1). M3: At least four papillary structures. (1 = Yes). |
m4_irregular_multi_gt_100mm |
Numeric (0 or 1). M4: Irregular multilocular solid tumor with largest diameter >= 100 mm. (1 = Yes). |
m5_strong_blood_flow |
Numeric (0 or 1). M5: Very strong blood flow (Color score 4). (1 = Yes). |
Value
A list containing:
Risk_of_Malignancy_Percent |
The estimated percentage probability that the tumor is malignant. |
Original_Classification |
The outcome based on the original non-risk-calculating Simple Rules (Benign, Malignant, or Inconclusive). |
References
Timmerman D, Van Calster B, Testa A, et al. Predicting the risk of malignancy in adnexal masses based on the Simple Rules from the International Ovarian Tumor Analysis group. Am J Obstet Gynecol. 2016;214(4):424-437. doi:10.1016/j.ajog.2016.01.007
Examples
# Example 1: Benign (Low Risk)
# Unilocular (B1), No flow (B5), No M features
iota_simple_rules_risk(1, 0, 0, 0, 1, 0, 0, 0, 0, 0)
# Example 2: Malignant (High Risk)
# Ascites (M2), Strong flow (M5), No B features
iota_simple_rules_risk(0, 0, 0, 0, 0, 0, 1, 0, 0, 1)
# Example 3: Inconclusive (Mixed features)
# Smooth Multi <100 (B4), but Strong flow (M5)
iota_simple_rules_risk(0, 0, 0, 1, 0, 0, 0, 0, 0, 1)
International Prognostic Index (IPI) for Diffuse Large B-Cell Lymphoma
Description
Calculates the IPI Score to predict prognosis in patients with Diffuse Large B-Cell Lymphoma (DLBCL). The score provides risk stratification based on the standard IPI model (pre-Rituximab era) and the Revised-IPI (R-IPI) model (Rituximab era). It uses five clinical factors: Age, Ann Arbor Stage, Serum LDH, ECOG Performance Status, and Number of Extranodal Sites.
Usage
ipi_score_dlbcl(age, stage, ldh_ratio, performance_status, extranodal_sites)
Arguments
age |
Numeric. Patient age in years. (>60 adds 1 point). |
stage |
Numeric. Ann Arbor Stage (1-4). (Stage III or IV adds 1 point). |
ldh_ratio |
Numeric. Ratio of patient's LDH to the upper limit of normal (ULN). (>1.0 adds 1 point). |
performance_status |
Numeric. ECOG Performance Status (0-4). (>=2 adds 1 point). |
extranodal_sites |
Numeric. Number of extranodal sites involved. (>1 adds 1 point). |
Value
A list containing:
IPI_Score |
The calculated total score (Range 0-5). |
Standard_IPI_Classification |
Risk group and survival estimate based on the original IPI study. |
Revised_IPI_Classification |
Risk group and survival estimate based on the R-IPI study (Rituximab-treated patients). |
References
The International Non-Hodgkin's Lymphoma Prognostic Factors Project. A predictive model for aggressive non-Hodgkin's lymphoma. N Engl J Med. 1993;329(14):987-994. doi:10.1056/NEJM199309303291402 Sehn LH, Berry B, Chhanabhai M, et al. The revised International Prognostic Index (R-IPI) is a better predictor of outcome than the standard IPI for patients with diffuse large B-cell lymphoma treated with R-CHOP. Blood. 2007;109(5):1857-1861. doi:10.1182/blood-2006-08-038257
Examples
# Example 1: High Risk (Standard) / Poor Risk (R-IPI)
# Age 70 (+1), Stage IV (+1), LDH 2x (+1), ECOG 1 (0), 2 Extranodal (+1)
# Score = 4
ipi_score_dlbcl(70, 4, 2.0, 1, 2)
# Example 2: Low Risk (Standard) / Very Good Risk (R-IPI)
# Age 50 (0), Stage II (0), LDH 0.8 (0), ECOG 0 (0), 0 Extranodal (0)
# Score = 0
ipi_score_dlbcl(50, 2, 0.8, 0, 0)
International Prognostic Score for Asymptomatic Early-stage CLL (IPS-E)
Description
Calculates the IPS-E score to predict the risk of needing treatment (time to first treatment) within 5 years for patients with asymptomatic early-stage Chronic Lymphocytic Leukemia (CLL) (Binet A or Rai 0). The score uses three independent prognostic factors: IGHV mutation status, absolute lymphocyte count, and palpable lymph nodes.
Usage
ips_e_score(ighv_unmutated, lymphocyte_count, palpable_nodes)
Arguments
ighv_unmutated |
Numeric (0 or 1). IGHV mutational status. (1 = Unmutated, 0 = Mutated). Unmutated status adds 1 point. |
lymphocyte_count |
Numeric. Absolute Lymphocyte Count (ALC) in x 10^9/L. (> 15 x 10^9/L adds 1 point). |
palpable_nodes |
Numeric (0 or 1). Presence of palpable lymph nodes. (1 = Yes, +1 point). |
Value
A list containing:
IPS_E_Score |
The calculated total score (Range 0-3). |
Risk_Group |
Classification (Low: 0, Intermediate: 1, High: 2-3). |
Est_5_Year_Treatment_Risk |
Estimated probability of requiring treatment within 5 years. |
References
Condoluci A, et al. International prognostic score for asymptomatic early-stage chronic lymphocytic leukemia. Blood. 2020;135(21):1859-1869. doi:10.1182/blood.2019003453
Examples
# Example 1: High Risk
# Unmutated IGHV (1), ALC 20 (1), No Nodes (0)
# Score = 2
ips_e_score(1, 20, 0)
# Example 2: Low Risk
# Mutated IGHV (0), ALC 10 (0), No Nodes (0)
# Score = 0
ips_e_score(0, 10, 0)
Revised International Prognostic Scoring System (IPSS-R) for MDS
Description
Calculates the IPSS-R score for risk stratification in patients with Myelodysplastic Syndromes (MDS). The score utilizes five variables: cytogenetics, bone marrow blast percentage, hemoglobin, platelet count, and absolute neutrophil count (ANC) to predict overall survival and risk of transformation to Acute Myeloid Leukemia (AML).
Usage
ipss_r_mds_score(hemoglobin_g_dl, anc_x10_9_l, platelet_count_x10_9_l,
bone_marrow_blasts_percent, cytogenetics_risk_group)
Arguments
hemoglobin_g_dl |
Numeric. Hemoglobin level in g/dL. >=10: 0 pts. 8-<10: 1 pt. <8: 1.5 pts. |
anc_x10_9_l |
Numeric. Absolute Neutrophil Count in x10^9/L. >=0.8: 0 pts. <0.8: 0.5 pts. |
platelet_count_x10_9_l |
Numeric. Platelet count in x10^9/L. >=100: 0 pts. 50-<100: 0.5 pts. <50: 1 pt. |
bone_marrow_blasts_percent |
Numeric. Percentage of blasts in bone marrow. <=2: 0 pts. >2-<5: 1 pt. 5-10: 2 pts. >10: 3 pts. |
cytogenetics_risk_group |
String. Cytogenetic risk category based on karyotype. "very_good": -Y, del(11q). (0 pts). "good": Normal, del(5q), del(12p), del(20q), double including del(5q). (1 pt). "intermediate": del(7q), +8, +19, i(17q), any other single or double independent clones. (2 pts). "poor": -7, inv(3)/t(3q)/del(3q), double including -7/del(7q), Complex (3 abnormalities). (3 pts). "very_poor": Complex (>3 abnormalities). (4 pts). |
Value
A list containing:
IPSS_R_Score |
The calculated total score (Range 0-10+). |
Risk_Category |
Classification (Very Low, Low, Intermediate, High, Very High). |
Median_Overall_Survival |
Estimated median survival time. |
Time_to_25_Percent_AML_Evolution |
Estimated time until 25% of patients progress to AML. |
References
Greenberg PL, Tuechler H, Schanz J, et al. Revised international prognostic scoring system for myelodysplastic syndromes. Blood. 2012;120(12):2454-2465. doi:10.1182/blood-2012-03-420489
Examples
# Example 1: High Risk
# Hb 9 (1), ANC 0.5 (0.5), Plt 40 (1), Blasts 8% (2), Poor Cyto (3)
# Score = 1 + 0.5 + 1 + 2 + 3 = 7.5
ipss_r_mds_score(9, 0.5, 40, 8, "poor")
# Example 2: Very Low Risk
# Hb 11 (0), ANC 1.5 (0), Plt 200 (0), Blasts 1% (0), Very Good Cyto (0)
# Score = 0
ipss_r_mds_score(11, 1.5, 200, 1, "very_good")
irAE Grading for Colitis (GI Toxicities)
Description
Calculates the CTCAE severity grade for colitis associated with immune checkpoint inhibitor (ICPi) therapy. Grading is based on the increase in stool frequency over baseline, presence of incontinence, severity of symptoms (pain, blood, mucus), and life-threatening complications (e.g., perforation).
[Image of bristol stool scale chart]
Usage
irae_colitis_grading(stools_above_baseline, incontinence, life_threatening,
pain_mucus_blood)
Arguments
stools_above_baseline |
Numeric. Number of stools per day ABOVE the patient's baseline. (<4: Grade 1, 4-6: Grade 2, >=7: Grade 3). |
incontinence |
Numeric (0 or 1). New onset of incontinence? (1 = Yes). Presence indicates at least Grade 3. |
life_threatening |
Numeric (0 or 1). Are there life-threatening consequences (e.g., perforation, shock)? (1 = Yes). Indicates Grade 4. |
pain_mucus_blood |
Numeric (0 or 1). Presence of severe abdominal pain, mucus, or blood in stool? (1 = Yes). Often associated with Grade 3 severity in clinical context/guidelines if impacting ADL, though pure stool count is primary driver. |
Value
A list containing:
CTCAE_Grade |
The calculated adverse event grade (1-4). |
Definition |
Clinical description of the grade. |
Management_Recommendation |
Guidance on ICPi continuation and immunosuppressive therapy based on ASCO guidelines. |
References
Brahmer JR, Lacchetti C, Schneider BJ, et al. Management of Immune-Related Adverse Events in Patients Treated With Immune Checkpoint Inhibitor Therapy: American Society of Clinical Oncology Clinical Practice Guideline. J Clin Oncol. 2018;36(17):1714-1768. doi:10.1200/JCO.2017.77.6385
Examples
# Example 1: Grade 3 Colitis
# 8 stools over baseline, no life threatening signs
irae_colitis_grading(8, 0, 0, 0)
# Example 2: Grade 2 Colitis
# 5 stools over baseline
irae_colitis_grading(5, 0, 0, 0)
irAE Grading for Diabetes Mellitus (Endocrine Toxicities)
Description
Calculates the CTCAE severity grade for hyperglycemia/diabetes mellitus associated with immune checkpoint inhibitor (ICPi) therapy. Grading is based on fasting glucose levels and the presence of life-threatening complications like ketoacidosis.
Usage
irae_endocrine_diabetes_grading(fasting_glucose_mg_dl, metabolic_acidosis_present,
insulin_dependence)
Arguments
fasting_glucose_mg_dl |
Numeric. Fasting plasma glucose level in mg/dL. |
metabolic_acidosis_present |
Numeric (0 or 1). Presence of ketoacidosis or metabolic acidosis. (1 = Yes). |
insulin_dependence |
Numeric (0 or 1). Does the patient require insulin for control? (1 = Yes). |
Value
A list containing:
CTCAE_Grade |
The calculated adverse event grade (1-4). |
Definition |
Clinical description of the grade. |
Management |
Recommended management strategy based on ASCO guidelines. |
References
Brahmer JR, Lacchetti C, Schneider BJ, et al. Management of Immune-Related Adverse Events in Patients Treated With Immune Checkpoint Inhibitor Therapy: American Society of Clinical Oncology Clinical Practice Guideline. J Clin Oncol. 2018;36(17):1714-1768. doi:10.1200/JCO.2017.77.6385
Examples
# Example 1: Severe Hyperglycemia
# Glucose 400 mg/dL, No Acidosis, Needs Insulin
irae_endocrine_diabetes_grading(400, 0, 1)
# Example 2: DKA (Life-threatening)
# Glucose 600 mg/dL, Acidosis Present
irae_endocrine_diabetes_grading(600, 1, 1)
irAE Grading for Hepatitis (GI Toxicities)
Description
Calculates the CTCAE severity grade for immune-mediated hepatitis associated with immune checkpoint inhibitor (ICPi) therapy. Grading is based on the elevation of liver transaminases (AST/ALT) and Total Bilirubin relative to the Upper Limit of Normal (ULN).
Usage
irae_hepatitis_grading(ast, alt, total_bilirubin, ast_uln, alt_uln, bilirubin_uln)
Arguments
ast |
Numeric. Patient's current AST level. |
alt |
Numeric. Patient's current ALT level. |
total_bilirubin |
Numeric. Patient's current Total Bilirubin level. |
ast_uln |
Numeric. The laboratory's Upper Limit of Normal for AST. |
alt_uln |
Numeric. The laboratory's Upper Limit of Normal for ALT. |
bilirubin_uln |
Numeric. The laboratory's Upper Limit of Normal for Total Bilirubin. |
Value
A list containing:
CTCAE_Grade |
The calculated adverse event grade (0-4). |
Definition |
The criteria met for the specific grade. |
Management_Recommendation |
Guidance on ICPi continuation and immunosuppressive therapy based on ASCO guidelines. |
References
Brahmer JR, Lacchetti C, Schneider BJ, et al. Management of Immune-Related Adverse Events in Patients Treated With Immune Checkpoint Inhibitor Therapy: American Society of Clinical Oncology Clinical Practice Guideline. J Clin Oncol. 2018;36(17):1714-1768. doi:10.1200/JCO.2017.77.6385
Examples
# Example 1: Grade 3 Hepatitis
# AST 250 (ULN 40 -> 6.25x), Bili Normal
irae_hepatitis_grading(250, 40, 1.0, 40, 40, 1.2)
# Example 2: Grade 1 Hepatitis
# ALT 80 (ULN 40 -> 2x), Bili Normal
irae_hepatitis_grading(30, 80, 0.8, 40, 40, 1.2)
irAE Grading for Hypothyroidism
Description
Calculates the CTCAE severity grade for hypothyroidism associated with immune checkpoint inhibitor (ICPi) therapy. Grading relies on the presence of symptoms, the impact on Activities of Daily Living (ADL), and the presence of life-threatening consequences (e.g., myxedema coma).
Usage
irae_hypothyroidism_grading(symptomatic, adl_limitation, life_threatening)
Arguments
symptomatic |
Numeric (0 or 1). Are symptoms present? (1 = Yes). |
adl_limitation |
Numeric (0, 1, or 2). Limitation of Activities of Daily Living. 0: No limitation. 1: Limiting instrumental ADL (e.g., preparing meals, shopping). 2: Limiting self-care ADL (e.g., bathing, dressing, feeding). |
life_threatening |
Numeric (0 or 1). Are there life-threatening consequences? (1 = Yes). |
Value
A list containing:
CTCAE_Grade |
The calculated adverse event grade (1-4). |
Definition |
Clinical description of the grade. |
Management_Recommendation |
Guidance on ICPi continuation and thyroid replacement based on ASCO guidelines. |
References
Brahmer JR, Lacchetti C, Schneider BJ, et al. Management of Immune-Related Adverse Events in Patients Treated With Immune Checkpoint Inhibitor Therapy: American Society of Clinical Oncology Clinical Practice Guideline. J Clin Oncol. 2018;36(17):1714-1768. doi:10.1200/JCO.2017.77.6385
Examples
# Example 1: Grade 2 (Symptomatic)
# Symptoms Present, Instrumental ADL limited, Not life-threatening
irae_hypothyroidism_grading(1, 1, 0)
# Example 2: Grade 1 (Asymptomatic)
# TSH elevated but patient feels fine
irae_hypothyroidism_grading(0, 0, 0)
irAE Grading for Nephritis (Renal Toxicities)
Description
Calculates the CTCAE severity grade for immune-mediated nephritis associated with immune checkpoint inhibitor (ICPi) therapy. Grading is determined by the elevation of serum creatinine relative to the Upper Limit of Normal (ULN) or the patient's baseline creatinine.
Usage
irae_nephritis_grading(creatinine_level, creatinine_uln,
baseline_creatinine = NULL, life_threatening = 0)
Arguments
creatinine_level |
Numeric. Current serum creatinine level in mg/dL. |
creatinine_uln |
Numeric. The laboratory's Upper Limit of Normal for creatinine. |
baseline_creatinine |
Numeric (Optional). The patient's pre-treatment baseline creatinine level. Used for grading (e.g., >1.5x baseline). |
life_threatening |
Numeric (0 or 1). Are there life-threatening consequences (e.g., dialysis indicated)? (1 = Yes). |
Value
A list containing:
CTCAE_Grade |
The calculated adverse event grade (0-4). |
Definition |
Clinical description of the grade criteria met. |
Management_Recommendation |
Guidance on ICPi continuation and immunosuppressive therapy based on ASCO guidelines. |
References
Brahmer JR, Lacchetti C, Schneider BJ, et al. Management of Immune-Related Adverse Events in Patients Treated With Immune Checkpoint Inhibitor Therapy: American Society of Clinical Oncology Clinical Practice Guideline. J Clin Oncol. 2018;36(17):1714-1768. doi:10.1200/JCO.2017.77.6385
Examples
# Example 1: Grade 2 Nephritis (Based on ULN)
# Cr 2.0 (ULN 1.2 -> ratio 1.66)
irae_nephritis_grading(2.0, 1.2)
# Example 2: Grade 3 Nephritis (Based on Baseline)
# Cr 3.5 (Baseline 1.0 -> ratio 3.5)
irae_nephritis_grading(3.5, 1.2, baseline_creatinine = 1.0)
irAE Grading for Pneumonitis (Lung Toxicities)
Description
Calculates the CTCAE severity grade for pneumonitis associated with immune checkpoint inhibitor (ICPi) therapy. Grading is based on clinical symptoms (asymptomatic vs. symptomatic), radiographic findings, and the need for oxygen supplementation or urgent intervention.
Usage
irae_pneumonitis_grading(asymptomatic, symptomatic, severe_symptoms,
life_threatening, hypoxia_on_room_air, oxygen_needed,
oxygen_management)
Arguments
asymptomatic |
Numeric (0 or 1). Asymptomatic, radiographic findings only? (1 = Yes). |
symptomatic |
Numeric (0 or 1). Symptomatic (e.g., cough, dyspnea), but not severe? (1 = Yes). |
severe_symptoms |
Numeric (0 or 1). Severe symptoms or limiting self-care ADL? (1 = Yes). |
life_threatening |
Numeric (0 or 1). Life-threatening respiratory compromise? (1 = Yes). |
hypoxia_on_room_air |
Numeric (0 or 1). Hypoxia present on room air? (1 = Yes). Indicates Grade >= 3. |
oxygen_needed |
Numeric (0 or 1). Oxygen supplementation required? (1 = Yes). |
oxygen_management |
String. Type of oxygen support (optional for grading logic but useful for context). Options: "none", "low_flow", "high_flow", "intubation". |
Value
A list containing:
CTCAE_Grade |
The calculated adverse event grade (0-4). |
Definition |
Clinical description of the grade. |
Management_Recommendation |
Guidance on ICPi continuation and immunosuppressive therapy based on ASCO guidelines. |
References
Brahmer JR, Lacchetti C, Schneider BJ, et al. Management of Immune-Related Adverse Events in Patients Treated With Immune Checkpoint Inhibitor Therapy: American Society of Clinical Oncology Clinical Practice Guideline. J Clin Oncol. 2018;36(17):1714-1768. doi:10.1200/JCO.2017.77.6385
Examples
# Example 1: Grade 2 (Symptomatic)
# Cough/Dyspnea, No O2 needed
irae_pneumonitis_grading(0, 1, 0, 0, 0, 0, "none")
# Example 2: Grade 3 (Hypoxia)
# Severe symptoms, Hypoxia on room air, O2 needed
irae_pneumonitis_grading(0, 1, 1, 0, 1, 1, "low_flow")
4C Mortality Score for COVID-19
Description
Calculates the ISARIC 4C Mortality Score to predict in-hospital mortality risk for patients admitted with COVID-19. This score was derived from a large UK cohort and outperforms many other risk stratification tools. It assigns patients to Low, Intermediate, High, or Very High risk groups.
Usage
isaric_4c_mortality(age, sex, comorbidities, resp_rate, o2_sat, gcs,
urea, crp, urea_units = "mmol/L", crp_units = "mg/L")
Arguments
age |
Numeric. Patient age in years. |
sex |
String. Biological sex ("Male" or "Female"). |
comorbidities |
Numeric. Number of relevant comorbidities (0, 1, or >=2). Relevant comorbidities include: Chronic cardiac disease, chronic respiratory disease (excluding asthma), chronic renal disease (eGFR <= 30), mild-severe liver disease, dementia, chronic neurological conditions, connective tissue disease, diabetes. |
resp_rate |
Numeric. Respiratory rate in breaths per minute. |
o2_sat |
Numeric. Peripheral oxygen saturation (%) on room air. |
gcs |
Numeric. Glasgow Coma Scale score (3-15). |
urea |
Numeric. Serum Urea or BUN level. |
crp |
Numeric. C-Reactive Protein level. |
urea_units |
String. Units for the urea input. Options: "mmol/L" (default) or "mg/dL" (treats input as Blood Urea Nitrogen/BUN). |
crp_units |
String. Units for the CRP input. Options: "mg/L" (default) or "mg/dL". |
Value
A list containing:
Total_Score |
The calculated 4C Mortality Score (Range 0-21). |
Risk_Group |
Risk classification (Low, Intermediate, High, Very High). |
Est_In_Hospital_Mortality |
Estimated mortality percentage based on the validation cohort. |
Recommendation |
Clinical management suggestion. |
References
Knight SR, et al. Risk stratification of patients admitted to hospital with covid-19 using the ISARIC WHO Clinical Characterisation Protocol: development and validation of the 4C Mortality Score. BMJ. 2020;370:m3339. doi:10.1136/bmj.m3339
Examples
# Example 1: High Risk Patient
# 75yo Male, 2 comorbidities, RR 22, O2 91%, GCS 15, High Urea/CRP
isaric_4c_mortality(
age = 75, sex = "male", comorbidities = 2,
resp_rate = 22, o2_sat = 91, gcs = 15,
urea = 15, crp = 120, urea_units = "mmol/L", crp_units = "mg/L"
)
# Example 2: Low Risk Patient
# 45yo Female, 0 comorbidities, Normal vitals and labs
isaric_4c_mortality(
age = 45, sex = "female", comorbidities = 0,
resp_rate = 16, o2_sat = 98, gcs = 15,
urea = 4, crp = 10, urea_units = "mmol/L", crp_units = "mg/L"
)
Index of Severity for Eosinophilic Esophagitis (I-SEE)
Description
Calculates the I-SEE score to assess the severity of Eosinophilic Esophagitis (EoE). The score categorizes disease activity into Inactive, Mild, Moderate, or Severe based on symptoms, complications, and inflammatory/fibrostenotic features found on endoscopy and histology.
Usage
isee_eoe_severity_index(symptoms_frequency,
food_impaction_code, hospitalization_eoe,
esophageal_perforation, malnutrition_code,
persistent_inflammation,
endoscopic_inflammatory_grade,
peak_eosinophil_count_grade,
endoscopic_fibrostenotic_grade,
histologic_fibrostenotic_grade)
Arguments
symptoms_frequency |
Numeric. Frequency of symptoms (Dysphagia, Pain, etc.). 0: None. 1: Weekly. 2: Daily. 3: Multiple times per day or disrupting social functioning. |
food_impaction_code |
Numeric. History of food impaction requiring ER visit or endoscopy. 0: None. 1: Food impaction in adult (>=18 years). 2: Food impaction in child (<18 years). |
hospitalization_eoe |
Numeric (0 or 1). Hospitalization due to EoE (excluding planned elective procedures). (1 = Yes, +4 points). |
esophageal_perforation |
Numeric (0 or 1). History of esophageal perforation. (1 = Yes, +15 points). |
malnutrition_code |
Numeric (0 or 1). Malnutrition (BMI <5th percentile or decreased growth trajectory). (1 = Yes, +15 points). |
persistent_inflammation |
Numeric (0 or 1). Persistent inflammation requiring elemental formula, systemic steroids, or biologics. (1 = Yes, +15 points). |
endoscopic_inflammatory_grade |
Numeric. Endoscopic inflammatory features (Edema, Furrows, Exudates). 0: None. 1: Localized. 2: Diffuse. |
peak_eosinophil_count_grade |
Numeric. Peak Eosinophil Count (eos/hpf). 0: < 15. 1: 15-60. 2: > 60. |
endoscopic_fibrostenotic_grade |
Numeric. Endoscopic fibrostenotic features (Rings, Strictures). 0: None. 1: Present, endoscope passes easily. 2: Present, requires dilation or snug fit. 3: Cannot pass standard scope, repeated dilations (adult), or any dilation (child). (+15 points). |
histologic_fibrostenotic_grade |
Numeric (0 or 1). Histologic fibrostenotic features (Basal zone hyperplasia, lamina propria fibrosis). (1 = Yes, +2 points). |
Value
A list containing:
ISEE_Score |
The calculated total severity score. |
Severity |
Classification (Inactive <1, Mild 1-6, Moderate 7-14, Severe >=15). |
References
Dellon ES, Khoury P, Muir AB, et al. A Clinical Severity Index for Eosinophilic Esophagitis: Development, Consensus, and Future Directions. Gastroenterology. 2022;163(1):59-76. doi:10.1053/j.gastro.2022.03.025
Examples
# Example 1: Moderate EoE
# Daily symptoms(2), Localized inflam(1), Eos 40(1), BZH(2)
# Score = 2 + 1 + 1 + 2 = 6 (Wait, 6 is Mild? Check logic. Mild 1-6. So Mild/Moderate border.)
isee_eoe_severity_index(2, 0, 0, 0, 0, 0, 1, 1, 0, 1)
# Example 2: Severe EoE
# Stricture requiring dilation (+15), Daily Sx (+2)
# Score = 17
isee_eoe_severity_index(2, 0, 0, 0, 0, 0, 1, 1, 3, 0)
Ishihara Color Vision Test Screening Interpretation
Description
Interprets the results of the Ishihara Test for Color Blindness based on the number of plates administered and the number of errors made. The function supports the standard 38-plate, 24-plate, and short screening (14-plate) editions. It screens primarily for congenital red-green color deficiencies (protan and deutan defects).
Usage
ishihara_screening_result(total_plates_administered, error_count)
Arguments
total_plates_administered |
Numeric. The total number of plates included in the specific test edition used (typically 14, 24, or 38). |
error_count |
Numeric. The total number of plates read incorrectly by the patient. (Note: Plate 1 is usually a control and should be read correctly by all; if missed, the test is invalid, but this function counts it as a standard error). |
Value
A list containing:
Test_Format |
Indicates which edition of the test was likely used. |
Screening_Result |
"Normal Color Vision", "Color Vision Deficiency Suspected", or "Indeterminate". |
Interpretation |
Clinical context of the result. |
Next_Steps |
Recommendations for referral or further testing (e.g., Anomaloscope). |
References
Ishihara S. Tests for colour-blindness. Kanehara Shuppan. 1972.
Examples
# Example 1: Normal Result (38-plate edition)
# 2 errors made out of 38
ishihara_screening_result(38, 2)
# Example 2: Deficiency Suspected (14-plate short screening)
# 5 errors made out of 14
ishihara_screening_result(14, 5)
International Staging System (ISS) for Multiple Myeloma
Description
Calculates the International Staging System (ISS) stage for multiple myeloma. This system stratifies patients into three prognostic groups based on serum beta-2 microglobulin and serum albumin levels.
Usage
iss_multiple_myeloma(beta2_microglobulin, albumin)
Arguments
beta2_microglobulin |
Numeric. Serum Beta-2 Microglobulin level in mg/L. |
albumin |
Numeric. Serum Albumin level in g/dL. |
Value
A list containing:
ISS_Stage |
The calculated stage (I, II, or III). |
Median_Overall_Survival |
Estimated median overall survival based on the original study data. |
References
Greipp PR, San Miguel J, Durie BG, et al. International staging system for multiple myeloma. J Clin Oncol. 2005;23(15):3412-3420. doi:10.1200/JCO.2005.04.242
Examples
# Example 1: Stage I (Low B2M, Normal Albumin)
# B2M 2.5, Alb 4.0
iss_multiple_myeloma(2.5, 4.0)
# Example 2: Stage III (High B2M)
# B2M 6.0, Alb 3.0
iss_multiple_myeloma(6.0, 3.0)
# Example 3: Stage II (Intermediate)
# B2M 4.0 (Between 3.5 and 5.5)
iss_multiple_myeloma(4.0, 3.5)
ISTH Criteria for Disseminated Intravascular Coagulation (DIC)
Description
Calculates the score for Disseminated Intravascular Coagulation (DIC) based on the International Society on Thrombosis and Haemostasis (ISTH) criteria. This scoring system assesses platelet count, fibrin-related markers (e.g., D-dimer), prothrombin time prolongation, and fibrinogen levels to determine if a patient has overt DIC.
Usage
isth_dic_score(platelet_count, pt_prolongation_seconds, fibrinogen_g_l,
fibrin_marker_increase)
Arguments
platelet_count |
Numeric. Platelet count in x 10^9/L (or x 10^3/uL). < 50: +2 points. 50-100: +1 point. > 100: 0 points. |
pt_prolongation_seconds |
Numeric. Prolongation of Prothrombin Time (PT) in seconds (Patient PT - Normal/Control PT). >= 6 sec: +2 points. 3 - < 6 sec: +1 point. < 3 sec: 0 points. |
fibrinogen_g_l |
Numeric. Fibrinogen level in g/L. < 1.0 g/L: +1 point. >= 1.0 g/L: 0 points. |
fibrin_marker_increase |
String. Level of increase in fibrin-related markers (e.g., D-dimer, FDP). "none": No increase (0 points). "moderate": Moderate increase (e.g., > Upper Limit of Normal; +2 points). "strong": Strong increase (e.g., > 5x Upper Limit of Normal; +3 points). |
Value
A list containing:
ISTH_DIC_Score |
The calculated total score (Range 0-8). |
Interpretation |
Diagnostic interpretation based on the threshold of 5. |
References
Taylor FB Jr, Toh CH, Hoots WK, et al. Towards definition, clinical and laboratory criteria, and a scoring system for disseminated intravascular coagulation. Thromb Haemost. 2001;86(5):1327-1330.
Examples
# Example 1: Overt DIC
# Platelets 40k (+2), Strong D-dimer (+3), PT prolonged 4s (+1), Fib 0.8 (+1)
# Score = 7
isth_dic_score(40, 4, 0.8, "strong")
# Example 2: Non-overt DIC
# Platelets 120k (0), Moderate D-dimer (+2), PT prolonged 1s (0), Fib 2.0 (0)
# Score = 2
isth_dic_score(120, 1, 2.0, "moderate")
ISTH-SCC Bleeding Assessment Tool (BAT)
Description
Calculates the ISTH-SCC BAT score to screen for inherited bleeding disorders (e.g., von Willebrand disease, platelet disorders). The tool evaluates bleeding severity across 13 domains, assigning points (0-4) based on the level of medical intervention required.
Usage
isth_scc_bleeding_tool(epistaxis_score, cutaneous_score, minor_wounds_score,
oral_cavity_score, gi_bleeding_score, pulmonary_score,
hematuria_score, menorrhagia_score, postpartum_hemorrhage_score,
surgery_bleeding_score, dental_bleeding_score,
cns_bleeding_score, other_bleeding_score, age, sex)
Arguments
epistaxis_score |
Numeric (0-4). Score for nosebleeds. |
cutaneous_score |
Numeric (0-4). Score for bruising/petechiae. |
minor_wounds_score |
Numeric (0-4). Score for bleeding from minor cuts. |
oral_cavity_score |
Numeric (0-4). Score for gum bleeding/oral cavity. |
gi_bleeding_score |
Numeric (0-4). Score for gastrointestinal bleeding. |
pulmonary_score |
Numeric (0-4). Score for hemoptysis. |
hematuria_score |
Numeric (0-4). Score for blood in urine. |
menorrhagia_score |
Numeric (0-4). Score for heavy menstrual bleeding. |
postpartum_hemorrhage_score |
Numeric (0-4). Score for bleeding after delivery. |
surgery_bleeding_score |
Numeric (0-4). Score for bleeding during/after surgery. |
dental_bleeding_score |
Numeric (0-4). Score for bleeding after dental procedures. |
cns_bleeding_score |
Numeric (0-4). Score for intracranial/CNS bleeding (usually 0 or 4). |
other_bleeding_score |
Numeric (0-4). Score for other types (e.g., ovulation, muscle/joint). |
age |
Numeric. Patient age in years. |
sex |
String. "Male" or "Female". |
Details
General Scoring Key: 0 = No symptoms 1 = Reported, no medical attention 2 = Medical attention (consultation) 3 = Surgical intervention, packing, cauterization, or antifibrinolytics 4 = Blood transfusion, replacement therapy, or desmopressin
Abnormal Cutoffs: Children (<18y): >= 3 Adult Males: >= 4 Adult Females: >= 6
Value
A list containing:
ISTH_BAT_Score |
The calculated total score. |
Interpretation |
Screening result based on age/sex-specific cutoffs. |
Cutoff_Applied |
The threshold used for the interpretation. |
References
Rodeghiero F, Tosetto A, Abshire T, et al. ISTH/SSC bleeding assessment tool: a standardized questionnaire and a proposal for a new bleeding score for inherited bleeding disorders. J Thromb Haemost. 2010;8(9):2063-2065. doi:10.1111/j.1538-7836.2010.03975.x
Examples
# Example 1: Abnormal (Adult Female)
# Menorrhagia (3 - intervention), Epistaxis (2 - consult), Cutaneous (2 - consult)
# Score = 7 (Cutoff 6)
isth_scc_bleeding_tool(2, 2, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 30, "female")
# Example 2: Normal (Adult Male)
# Cutaneous (1), Minor wounds (1)
# Score = 2 (Cutoff 4)
isth_scc_bleeding_tool(0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, "male")
Indian Takayasu Clinical Activity Score (ITAS2010)
Description
Calculates the ITAS2010 and ITAS-A scores to assess disease activity in patients with Takayasu Arteritis. The score assigns weighted points to new or worsening clinical features across systemic, cardiovascular, neurologic, renal, and other domains. A score of 1 or greater indicates active disease. The ITAS-A includes acute phase reactants (ESR/CRP) for enhanced sensitivity.
Usage
itas2010_score(systemic_symptoms, arthralgia, carotidynia, pulse_deficit, bruit,
bp_discrepancy, claudication, hypertension, dyspnea, abdominal_pain,
cutaneous_lesions, aortic_regurgitation, angina, heart_failure,
syncope, tia, renal_failure, stroke, myocardial_infarction,
bowel_ischemia, esr_crp_elevated = 0)
Arguments
systemic_symptoms |
Numeric (0/1). Fever, malaise, or weight loss. (+1 pt). |
arthralgia |
Numeric (0/1). Arthralgia or myalgia. (+1 pt). |
carotidynia |
Numeric (0/1). Carotid tenderness. (+1 pt). |
pulse_deficit |
Numeric (0/1). Absent or unequal pulse. (+1 pt). |
bruit |
Numeric (0/1). Audible bruit. (+1 pt). |
bp_discrepancy |
Numeric (0/1). Blood pressure discrepancy between limbs. (+1 pt). |
claudication |
Numeric (0/1). Limb claudication. (+1 pt). |
hypertension |
Numeric (0/1). New or worsening hypertension. (+1 pt). |
dyspnea |
Numeric (0/1). Dyspnea or pleurisy. (+1 pt). |
abdominal_pain |
Numeric (0/1). Abdominal pain or nausea/vomiting. (+1 pt). |
cutaneous_lesions |
Numeric (0/1). Erythema nodosum or ulcers. (+1 pt). |
aortic_regurgitation |
Numeric (0/1). New or worsening AR. (+3 pts). |
angina |
Numeric (0/1). Angina pectoris. (+3 pts). |
heart_failure |
Numeric (0/1). Congestive heart failure. (+3 pts). |
syncope |
Numeric (0/1). Syncope or dizziness/vertigo. (+3 pts). |
tia |
Numeric (0/1). Transient Ischemic Attack or visual disturbance. (+3 pts). |
renal_failure |
Numeric (0/1). Renal failure. (+3 pts). |
stroke |
Numeric (0/1). Stroke. (+5 pts). |
myocardial_infarction |
Numeric (0/1). Myocardial infarction. (+5 pts). |
bowel_ischemia |
Numeric (0/1). Ischemic bowel. (+5 pts). |
esr_crp_elevated |
Numeric (0/1). Elevated ESR or CRP (for ITAS-A). (+1 pt). |
Value
A list containing:
ITAS2010_Score |
The clinical activity score (Clinical features only). |
ITAS_A_Score |
The activity score including acute phase reactants. |
Disease_Status |
"Active" if score >= 1, otherwise "Inactive". |
References
Misra DP, Rathore U, Patro P, et al. Disease Activity Indices in Takayasu Arteritis: A Systematic Review and Meta-Analysis. Rheumatol Ther. 2021. Jayakumar P, et al. Development and validation of the Indian Takayasu Clinical Activity Score (ITAS2010). Indian J Rheumatol. 2010.
Examples
# Example 1: Active Disease
# Pulse deficit (+1), Claudication (+1), Elevated ESR (+1)
# ITAS2010 = 2, ITAS-A = 3
itas2010_score(0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)
# Example 2: Severe Activity
# Stroke (+5), Hypertension (+1)
# ITAS2010 = 6
itas2010_score(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0)
IV Drip Rate Calculator
Description
Calculates the IV infusion rate in drops per minute (gtts/min). This formula is used when an electronic IV pump is unavailable, requiring manual regulation of the flow rate based on the tubing's drop factor (drops per milliliter).
Usage
iv_drip_rate(volume_ml, time_min, drop_factor_gtts_ml)
Arguments
volume_ml |
Numeric. The total volume of fluid to be infused in milliliters. |
time_min |
Numeric. The total time for the infusion in minutes. |
drop_factor_gtts_ml |
Numeric. The drop factor of the IV tubing set (gtts/mL). Common macrodrip factors are 10, 15, or 20 gtts/mL; microdrip is typically 60 gtts/mL. |
Value
A list containing:
Drip_Rate_gtts_min |
The calculated drip rate rounded to the nearest whole number (drops/minute). |
Examples
# Example 1: 1 Liter (1000 mL) over 8 hours (480 min) with 15 gtt/mL tubing
# Rate = (1000 * 15) / 480 = 31.25 -> 31 gtts/min
iv_drip_rate(1000, 480, 15)
# Example 2: 100 mL Antibiotic over 30 min with 20 gtt/mL tubing
# Rate = (100 * 20) / 30 = 66.6 -> 67 gtts/min
iv_drip_rate(100, 30, 20)
IWG-2 Criteria for Alzheimer's Disease Diagnosis
Description
Applies the International Working Group 2 (IWG-2) criteria (2014) for the diagnosis of Alzheimer's Disease. These criteria define AD as a clinico-biological entity, requiring both a specific clinical phenotype (typical amnestic or atypical) and in vivo evidence of Alzheimer's pathology (pathophysiological biomarkers).
Usage
iwg2_alzheimers_criteria(clinical_phenotype_present,
pathophysiological_marker_positive,
autosomal_dominant_mutation_present)
Arguments
clinical_phenotype_present |
Numeric (0 or 1). Presence of a specific clinical phenotype of AD (Typical Amnestic or Atypical: Posterior Cortical Atrophy, Logopenic Aphasia, Frontal Variant). (1 = Yes). |
pathophysiological_marker_positive |
Numeric (0 or 1). Presence of a positive pathophysiological biomarker (Low CSF Abeta42 + High Tau, or Positive Amyloid PET). (1 = Yes). |
autosomal_dominant_mutation_present |
Numeric (0 or 1). Presence of a proven autosomal dominant mutation (PSEN1, PSEN2, APP). (1 = Yes). |
Value
A list containing:
IWG2_Diagnosis |
The diagnostic category determined by the criteria. |
Classification |
General classification (Definite, Supported, At Risk, or Not Met). |
References
Dubois B, Feldman HH, Jacova C, et al. Advancing research diagnostic criteria for Alzheimer's disease: the IWG-2 criteria. Lancet Neurol. 2014;13(6):614-629. doi:10.1016/S1474-4422(14)70090-0
Examples
# Example 1: Diagnosis Confirmed
# Phenotype present (1), Positive Biomarker (1), No mutation (0)
iwg2_alzheimers_criteria(1, 1, 0)
# Example 2: Preclinical (Asymptomatic at risk)
# No symptoms (0), Positive Biomarker (1), No mutation (0)
iwg2_alzheimers_criteria(0, 1, 0)
Revised Jones Criteria for Acute Rheumatic Fever (2015)
Description
Evaluates the 2015 Revised Jones Criteria to diagnose Acute Rheumatic Fever (ARF). The criteria are stratified by population risk (Low vs. Moderate/High) and differ for initial versus recurrent attacks. Diagnosis generally requires evidence of preceding Group A Streptococcal infection plus either 2 Major criteria or 1 Major + 2 Minor criteria.
Usage
jones_criteria_diagnosis(risk_population, carditis, chorea, erythema_marginatum,
subcutaneous_nodules, joint_manifestation, fever_c,
esr, crp, prolonged_pr, evidence_gas, history_recurrence)
Arguments
risk_population |
String. "low" (ARF incidence <2/100k or RHD prevalence <1/1000) or "moderate_high". |
carditis |
Numeric (0 or 1). Clinical or subclinical carditis. (Major). |
chorea |
Numeric (0 or 1). Sydenham chorea. (Major). |
erythema_marginatum |
Numeric (0 or 1). Erythema marginatum. (Major). |
subcutaneous_nodules |
Numeric (0 or 1). Subcutaneous nodules. (Major). |
joint_manifestation |
String. Joint symptoms. Options: "none", "monoarthralgia", "polyarthralgia", "monoarthritis", "polyarthritis". Classification depends on risk: Low Risk: Polyarthritis (Major), Polyarthralgia (Minor). Mod/High Risk: Mono/Polyarthritis (Major), Mono/Polyarthralgia (Minor). |
fever_c |
Numeric. Temperature in Celsius. (Low Risk cutoff >= 38.5, Mod/High >= 38.0). |
esr |
Numeric. Erythrocyte Sedimentation Rate (mm/hr). (Low Risk cutoff >= 60, Mod/High >= 30). |
crp |
Numeric. C-Reactive Protein (mg/dL). (Cutoff >= 3.0). |
prolonged_pr |
Numeric (0 or 1). Prolonged PR interval for age. (Minor). *Note: Cannot be counted if Carditis is counted as Major.* |
evidence_gas |
Numeric (0 or 1). Evidence of preceding Group A Streptococcal infection (culture, rapid antigen, or elevated ASO/DNAse B). (Required unless Chorea/Carditis is the presenting sign). |
history_recurrence |
Numeric (0 or 1). Patient has a history of ARF or Rheumatic Heart Disease. (1 = Yes). If Yes, diagnosis can be made with 3 Minor criteria. |
Value
A list containing:
Diagnosis |
"Positive" or "Negative/Criteria Not Met". |
Major_Criteria_Met |
Count of Major criteria satisfied. |
Minor_Criteria_Met |
Count of Minor criteria satisfied. |
References
Gewitz MH, Baltimore RS, Tani LY, et al. Revision of the Jones Criteria for the diagnosis of acute rheumatic fever in the era of Doppler echocardiography: a scientific statement from the American Heart Association. Circulation. 2015;131(20):1806-1818. doi:10.1161/CIR.0000000000000205
Examples
# Example 1: Positive (Low Risk)
# Polyarthritis (Major), Fever 39 (Minor), ESR 70 (Minor), GAS Positive
# Result: Positive (1 Major + 2 Minor)
jones_criteria_diagnosis("low", 0, 0, 0, 0, "polyarthritis", 39.0, 70, 1.0, 0, 1, 0)
# Example 2: Positive (High Risk)
# Monoarthritis (Major), Fever 38.2 (Minor), CRP 5.0 (Minor), GAS Positive
# Result: Positive (1 Major + 2 Minor)
jones_criteria_diagnosis("moderate_high", 0, 0, 0, 0, "monoarthritis", 38.2, 10, 5.0, 0, 1, 0)
Karnofsky Performance Status (KPS) Scale
Description
Retrieves the definition and functional category for the Karnofsky Performance Status scale. The KPS allows patients to be classified as to their functional impairment. This can be used to compare effectiveness of different therapies and to assess the prognosis in individual patients.
Usage
karnofsky_performance_status(score)
Arguments
score |
Numeric. The KPS score. Must be a multiple of 10 between 0 and 100. |
Value
A list containing:
KPS_Score |
The input score. |
Definition |
Specific criteria regarding complaints and evidence of disease. |
Functional_Category |
Broad description of ability to work, live at home, or need for institutional care. |
References
Karnofsky DA, Burchenal JH. The Clinical Evaluation of Chemotherapeutic Agents in Cancer. In: MacLeod CM (Ed), Evaluation of Chemotherapeutic Agents. Columbia Univ Press. 1949:191-205.
Examples
# Example 1: Able to work, minor symptoms
karnofsky_performance_status(90)
# Example 2: Needs frequent medical care
karnofsky_performance_status(50)
Kawasaki Disease Diagnostic Criteria
Description
Evaluates the clinical diagnostic criteria for Kawasaki Disease (KD). According to the American Heart Association (AHA) guidelines, diagnosis of Complete KD requires fever for at least 5 days plus the presence of at least 4 of the 5 principal clinical features.
Usage
kawasaki_disease_criteria(fever_ge_5_days, conjunctivitis, oral_mucosal_changes,
extremity_changes, polymorphous_rash,
cervical_lymphadenopathy)
Arguments
fever_ge_5_days |
Numeric (0 or 1). Fever persisting for at least 5 days. (1 = Yes). |
conjunctivitis |
Numeric (0 or 1). Bilateral bulbar conjunctival injection without exudate. (1 = Yes). |
oral_mucosal_changes |
Numeric (0 or 1). Changes in lips and oral cavity (e.g., erythema, cracked lips, strawberry tongue). (1 = Yes). |
extremity_changes |
Numeric (0 or 1). Changes in extremities (e.g., edema, erythema of palms/soles, desquamation). (1 = Yes). |
polymorphous_rash |
Numeric (0 or 1). Polymorphous exanthem. (1 = Yes). |
cervical_lymphadenopathy |
Numeric (0 or 1). Cervical lymphadenopathy (>1.5 cm diameter), usually unilateral. (1 = Yes). |
Value
A list containing:
Diagnosis_Result |
Classification as "Complete Kawasaki Disease", "Incomplete Kawasaki Disease (Possible)", or "Criteria Not Met". |
Criteria_Count |
The number of principal clinical features present (excluding fever). |
Recommendation |
Clinical guidance based on the criteria met. |
References
McCrindle BW, Rowley AH, Newburger JW, et al. Diagnosis, Treatment, and Long-Term Management of Kawasaki Disease: A Scientific Statement for Health Professionals From the American Heart Association. Circulation. 2017;135(17):e927-e999. doi:10.1161/CIR.0000000000000484
Examples
# Example 1: Complete KD
# Fever >= 5 days, 4 clinical signs
kawasaki_disease_criteria(1, 1, 1, 1, 1, 0)
# Example 2: Incomplete KD Suspected
# Fever >= 5 days, 2 clinical signs
kawasaki_disease_criteria(1, 1, 0, 1, 0, 0)
# Example 3: Criteria Not Met
# Fever < 5 days
kawasaki_disease_criteria(0, 1, 1, 1, 1, 1)
Khorana Risk Score for Venous Thromboembolism in Cancer Patients
Description
Calculates the Khorana Score to predict the risk of Venous Thromboembolism (VTE) in ambulatory cancer patients initiating chemotherapy. The score stratifies patients into Low, Intermediate, or High risk categories based on cancer site, platelet count, hemoglobin, leukocyte count, and BMI.
Usage
khorana_vte_score(cancer_site_risk, platelet_count, hemoglobin, wbc_count, bmi)
Arguments
cancer_site_risk |
String. Risk category of the primary tumor site. "very_high": Stomach, Pancreas (+2 pts). "high": Lung, Lymphoma, Gynecologic, Bladder, Testicular (+1 pt). "low": Other sites (0 pts). |
platelet_count |
Numeric. Pre-chemotherapy platelet count in x10^9/L. (>= 350 adds 1 point). |
hemoglobin |
Numeric. Hemoglobin level in g/dL. (< 10 g/dL or use of ESAs adds 1 point). |
wbc_count |
Numeric. Pre-chemotherapy leukocyte count in x10^9/L. (> 11 adds 1 point). |
bmi |
Numeric. Body Mass Index in kg/m^2. (>= 35 adds 1 point). |
Value
A list containing:
Khorana_Score |
The calculated risk score (Range 0-6). |
Risk_Classification |
Risk group classification (Low, Intermediate, High). |
Estimated_VTE_Risk |
Estimated percentage risk of symptomatic VTE. |
References
Khorana AA, Kuderer NM, Culakova E, Lyman GH, Francis CW. Development and validation of a predictive model for chemotherapy-associated thrombosis. Blood. 2008;111(10):4902-4907. doi:10.1182/blood-2007-10-116327
Examples
# Example 1: High Risk (Pancreas)
# Pancreas (+2), Plt 400 (+1), BMI 28 (0)
# Score = 3
khorana_vte_score("very_high", 400, 12, 8, 28)
# Example 2: Low Risk (Breast)
# Breast (Low risk site 0), Normal labs, Normal BMI
# Score = 0
khorana_vte_score("low", 250, 13, 6, 24)
Calculate Kidney Failure Risk Percent
Description
Using commonly available lab values, calculate the percent chance of developing kidney failure in patients with CKD, as devised by Tangri et al. 2011 and validated by Tangri et al. 2016.
Usage
kid_risk_perc(egfr, sex, acr, age, alb, phos, bicarb, calc, units="")
Arguments
egfr |
Numeric value of eGFR in mL/min/1.73m^2. |
sex |
Char of M (male) or F (female). |
acr |
Numeric value of urine albumin/creatinine ratio in mg/g. |
age |
Numeric value of age in years. |
alb |
Numeric value of serum albumin in either non-SI (g/dL) or SI (g/L). |
phos |
Numeric value of serum phosphorous in either non-SI (mg/dL) or SI (mmol/L). |
bicarb |
Numeric value of serum bicarbonate in either non-SI (mEq/L) or SI (mmol/L). |
calc |
Numeric value of serum calcium in either non-SI (mg/dL) or SI (mmol/L). |
units |
String to specify non-SI units by not including units argument or SI units by including units="SI". |
Value
A numeric value/vector of the percent chance of developing kidney failure.
References
Tangri N, Stevens LA, Griffith J, et al. A predictive model for progression of chronic kidney disease to kidney failure. JAMA. 2011;305(15):1553-9. Tangri N, Grams ME, Levey AS, et al. Multinational Assessment of Accuracy of Equations for Predicting Risk of Kidney Failure: A Meta-analysis. JAMA. 2016;315(2):164-74.
Examples
# For non-SI measurements, the function is defined as
kid_risk_perc(10, "F", 29, 31, 2.7, 3.6, 18, 10)
# For SI measurements, the function is defined as
kid_risk_perc(10, "F", 29, 31, 2.7, 2, 18, 2.5, units = "SI")
Calculate Kidney Failure Risk Index
Description
Using commonly available lab values, calculate the risk index of developing kidney failure in patients with CKD, as devised by Tangri et al. 2011 and validated by Tangri et al. 2016.
Usage
kidney_risk_num(egfr, sex, acr, age, alb, phos, bicarb, calc, units="")
Arguments
egfr |
Numeric value of eGFR in mL/min/1.73m^2. |
sex |
Char of M (male) or F (female). |
acr |
Numeric value of urine albumin/creatinine ratio in mg/g. |
age |
Numeric value of age in years. |
alb |
Numeric value of serum albumin in either non-SI (g/dL) or SI (g/L). |
phos |
Numeric value of serum phosphorous in either non-SI (mg/dL) or SI (mmol/L). |
bicarb |
Numeric value of serum bicarbonate in either non-SI (mEq/L) or SI (mmol/L). |
calc |
Numeric value of serum calcium in either non-SI (mg/dL) or SI (mmol/L). |
units |
String to specify non-SI units by not including units argument or SI units by including units="SI". |
Value
A numeric value/vector of the chance of developing kidney failure.
References
Tangri N, Stevens LA, Griffith J, et al. A predictive model for progression of chronic kidney disease to kidney failure. JAMA. 2011;305(15):1553-9. Tangri N, Grams ME, Levey AS, et al. Multinational Assessment of Accuracy of Equations for Predicting Risk of Kidney Failure: A Meta-analysis. JAMA. 2016;315(2):164-74.
Examples
# For non-SI measurements, the function is defined as
kidney_risk_num(10, "F", 29, 31, 2.7, 3.6, 18, 10)
# For SI measurements, the function is defined as
kidney_risk_num(10, "F", 29, 31, 2.7, 2, 18, 2.5, units = "SI")
Killip Classification for Heart Failure in Acute MI
Description
Retrieves the clinical description and estimated mortality risk for the Killip Classification. This system stratifies patients with acute myocardial infarction based on the severity of heart failure presentation, ranging from no signs of failure (Class I) to cardiogenic shock (Class IV).
Usage
killip_classification(class_grade)
Arguments
class_grade |
Numeric (1-4). The Killip Class assigned to the patient. 1: No evidence of heart failure. 2: Findings consistent with mild-to-moderate heart failure (S3 gallop, rales < half lung fields, elevated JVD). 3: Frank pulmonary edema. 4: Cardiogenic shock. |
Value
A list containing:
Killip_Class |
The formatted class string. |
Clinical_Findings |
Description of the physical exam findings associated with the class. |
Estimated_30_Day_Mortality |
Estimated mortality risk based on the original 1967 data. |
References
Killip T 3rd, Kimball JT. Treatment of myocardial infarction in a coronary care unit. A two year experience with 250 patients. Am J Cardiol. 1967;20(4):457-464. doi:10.1016/0002-9149(67)90023-9
Examples
# Example 1: Class I (No HF)
killip_classification(1)
# Example 2: Class IV (Cardiogenic Shock)
killip_classification(4)
Kinetic Estimated Glomerular Filtration Rate (KeGFR)
Description
Calculates the Kinetic eGFR, a metric that adjusts the standard eGFR for rapid changes in serum creatinine levels. This provides a more accurate estimation of renal function in the context of Acute Kidney Injury (AKI), where creatinine production and excretion are not in steady state. The Baseline eGFR is calculated internally using the CKD-EPI 2021 (Race-Free) equation.
Usage
kinetic_egfr(initial_creatinine, final_creatinine, time_hours,
baseline_creatinine, age, sex, weight_kg)
Arguments
initial_creatinine |
Numeric. The first serum creatinine measurement in the interval (mg/dL). |
final_creatinine |
Numeric. The second serum creatinine measurement in the interval (mg/dL). |
time_hours |
Numeric. The time elapsed between the initial and final creatinine measurements in hours. |
baseline_creatinine |
Numeric. The patient's stable baseline serum creatinine (mg/dL). This is used to estimate the steady-state creatinine production rate. |
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). |
weight_kg |
Numeric. Patient weight in kilograms. Used to estimate the volume of distribution (Total Body Water). |
Value
A list containing:
Kinetic_eGFR |
The calculated kinetic GFR in mL/min/1.73m^2. |
Baseline_eGFR |
The steady-state eGFR derived from the baseline creatinine. |
References
Chen S. Retooling the Creatinine Clearance Equation to Estimate Kinetic GFR when the Plasma Creatinine Is Changing acutely. J Am Soc Nephrol. 2013;24(6):877-888. doi:10.1681/ASN.2012070653
Examples
# Example 1: Developing AKI
# Cr rose from 1.0 to 1.5 over 24 hours. Baseline was 1.0.
# Age 60, Male, 80kg
kinetic_egfr(1.0, 1.5, 24, 1.0, 60, "male", 80)
# Example 2: Recovery from AKI
# Cr fell from 3.0 to 2.0 over 24 hours. Baseline was 1.0.
# Age 60, Male, 80kg
kinetic_egfr(3.0, 2.0, 24, 1.0, 60, "male", 80)
King's College Criteria for Acetaminophen Toxicity
Description
Calculates the King's College Criteria (KCC) for predicting poor prognosis in patients with Acetaminophen (Paracetamol) induced acute liver failure. Meeting the criteria indicates a high risk of mortality without liver transplantation.
Usage
kings_college_criteria_acetaminophen(arterial_ph, inr, creatinine,
encephalopathy_grade,
creatinine_units = "mg/dL")
Arguments
arterial_ph |
Numeric. Arterial blood pH. |
inr |
Numeric. International Normalized Ratio. |
creatinine |
Numeric. Serum Creatinine level. |
encephalopathy_grade |
Numeric (0-4). Grade of hepatic encephalopathy (West Haven Criteria). 0: None. 1: Mild confusion/agitation. 2: Lethargy, disorientation. 3: Somnolence to semi-stupor, responsive to stimuli. 4: Coma. |
creatinine_units |
String. Units for creatinine input. Options: "mg/dL" (default) or "micromol/L" (or "umol/L"). |
Details
Criteria for Liver Transplantation are met if: 1. Arterial pH < 7.3 (irrespective of grade of encephalopathy). OR 2. All three of the following occur within a 24-hour period: - INR > 6.5 (PT > 100 seconds) - Serum Creatinine > 3.4 mg/dL (300 µmol/L) - Grade III or IV Encephalopathy
Value
A list containing:
Result |
Indication of whether the criteria for poor prognosis are met. |
Recommendation |
Clinical guidance regarding transplant referral. |
Criteria_Fulfilled |
Specific conditions that triggered the positive result. |
References
O'Grady JG, Alexander GJ, Hayllar KM, Williams R. Early indicators of prognosis in fulminant hepatic failure. Gastroenterology. 1989;97(2):439-445. doi:10.1016/0016-5085(89)90081-4
Examples
# Example 1: Criteria Met (Acidosis)
# pH 7.1, INR 2.0, Cr 1.0, Grade 1 Enceph
kings_college_criteria_acetaminophen(7.1, 2.0, 1.0, 1)
# Example 2: Criteria Met (Triad)
# pH 7.35, INR 7.0, Cr 4.0, Grade 3 Enceph
kings_college_criteria_acetaminophen(7.35, 7.0, 4.0, 3)
# Example 3: Criteria Not Met
# pH 7.35, INR 5.0, Cr 2.0, Grade 2 Enceph
kings_college_criteria_acetaminophen(7.35, 5.0, 2.0, 2)
Kocher Criteria for Septic Arthritis
Description
Calculates the Kocher Score to estimate the probability of septic arthritis in a pediatric patient presenting with a painful hip. The score is based on four clinical predictors: non-weight bearing, fever, elevated ESR, and elevated WBC count.
Usage
kocher_septic_arthritis(non_weight_bearing, temp_gt_38_5, esr_gt_40, wbc_gt_12000)
Arguments
non_weight_bearing |
Numeric (0 or 1). Is the patient unable to bear weight on the affected side? (1 = Yes). |
temp_gt_38_5 |
Numeric (0 or 1). Is the patient's temperature > 38.5 degrees Celsius? (1 = Yes). |
esr_gt_40 |
Numeric (0 or 1). Is the Erythrocyte Sedimentation Rate (ESR) > 40 mm/hr? (1 = Yes). |
wbc_gt_12000 |
Numeric (0 or 1). Is the White Blood Cell (WBC) count > 12,000 cells/mm^3? (1 = Yes). |
Value
A list containing:
Kocher_Score |
The calculated score (Range 0-4). |
Septic_Arthritis_Probability |
Estimated probability of septic arthritis based on the original validation data. |
References
Kocher MS, Zurakowski D, Kasser JR. Differentiating between septic arthritis and transient synovitis of the hip in children: an evidence-based clinical prediction algorithm. J Bone Joint Surg Am. 1999;81(12):1662-1670.
Examples
# Example 1: High Probability
# Non-weight bearing (1), Fever (1), ESR 50 (1), WBC 15k (1)
# Score = 4
kocher_septic_arthritis(1, 1, 1, 1)
# Example 2: Low Probability
# Non-weight bearing (1), No fever, ESR 10, WBC 8k
# Score = 1
kocher_septic_arthritis(1, 0, 0, 0)
Kruis Score for Irritable Bowel Syndrome (IBS)
Description
Calculates the Kruis Score to assist in the diagnosis of Irritable Bowel Syndrome (IBS). The score differentiates IBS from organic bowel disease based on history, symptom characteristics, and basic physical/laboratory findings.
Usage
kruis_ibs_score(symptoms_triad, odd_pain_description, alternating_bowel_habits,
duration_gt_2yr, abdominal_mass, leukocytosis, elevated_esr,
positive_fob)
Arguments
symptoms_triad |
Numeric (0 or 1). Presence of the triad: Abdominal pain, flatulence, and irregularity of bowel movements. (1 = Yes, +34 pts). |
odd_pain_description |
Numeric (0 or 1). Patient describes pain as "burning", "cutting", "very strong", "terrible", "feeling of pressure", "dull", "boring", or "not so bad". (1 = Yes, 0 pts; 0 = No, +23 pts). |
alternating_bowel_habits |
Numeric (0 or 1). Alternating constipation and diarrhea. (1 = Yes, +14 pts). |
duration_gt_2yr |
Numeric (0 or 1). Duration of symptoms > 2 years. (1 = Yes, +16 pts). |
abdominal_mass |
Numeric (0 or 1). Abdominal mass palpable on exam. (1 = Yes, 0 pts; 0 = No, +16 pts). |
leukocytosis |
Numeric (0 or 1). Leukocytosis (> 10,000 /uL). (1 = Yes, 0 pts; 0 = No, +16 pts). |
elevated_esr |
Numeric (0 or 1). ESR > 20 mm/hr (or >10 depending on lab). (1 = Yes, 0 pts; 0 = No, +13 pts). |
positive_fob |
Numeric (0 or 1). Positive Fecal Occult Blood test. (1 = Yes, 0 pts; 0 = No, +12 pts). |
Value
A list containing:
Kruis_Score |
The calculated total score. |
Result |
Diagnostic interpretation ("Diagnosed as IBS" if Score > 44). |
References
Kruis W, Thieme C, Weinzierl M, et al. A diagnostic score for the irritable bowel syndrome. Its value in the exclusion of organic disease. Gastroenterology. 1984;87(1):1-7.
Examples
# Example 1: Likely IBS
# Symptoms triad (1), No odd pain (0), Alternating (1), >2yr (1), No mass (0), No labs (0)
# Score = 34 + 23 + 14 + 16 + 16 + 16 + 13 + 12 = 144
kruis_ibs_score(1, 0, 1, 1, 0, 0, 0, 0)
# Example 2: Possible Organic Disease
# No triad (0), Odd pain desc (1), No alternating (0), Short duration (0), Mass (1), Labs normal (0)
# Score = 0 + 0 + 0 + 0 + 0 + 16 + 13 + 12 = 41 (<=44)
kruis_ibs_score(0, 1, 0, 0, 1, 0, 0, 0)
Kt/V for Dialysis Adequacy (Daugirdas Formula)
Description
Calculates the single-pool Kt/V (spKt/V) for hemodialysis adequacy using the Daugirdas Second Generation formula. This metric quantifies the dose of dialysis delivered by measuring urea clearance normalized to the patient's total body water volume.
Usage
kt_v_dialysis(pre_bun, post_bun, duration_hours, uf_volume_liters,
post_weight_kg)
Arguments
pre_bun |
Numeric. Pre-dialysis Blood Urea Nitrogen (BUN) level (mg/dL or mmol/L). Units must match post_bun. |
post_bun |
Numeric. Post-dialysis Blood Urea Nitrogen (BUN) level (mg/dL or mmol/L). Units must match pre_bun. |
duration_hours |
Numeric. Duration of the dialysis session in hours. |
uf_volume_liters |
Numeric. Volume of ultrafiltrate removed during the session in Liters. |
post_weight_kg |
Numeric. Patient's post-dialysis weight in kilograms. |
Details
The formula used is the Daugirdas Second Generation Logarithmic Estimate:
Kt/V = -ln(R - 0.008 \times t) + (4 - 3.5 \times R) \times \frac{UF}{W}
Where:
-
R= Post-BUN / Pre-BUN -
t= Duration in hours -
UF= Ultrafiltration volume in Liters -
W= Post-dialysis weight in kg
Value
A list containing:
Kt_V_Score |
The calculated Kt/V value. |
Interpretation |
Clinical interpretation based on the standard adequacy target (>= 1.2). |
References
Daugirdas JT. Second generation logarithmic estimates of single-pool variable volume Kt/V: an analysis of error. J Am Soc Nephrol. 1993;4(5):1205-1213. doi:10.1681/ASN.V451205
Examples
# Example 1: Adequate Dialysis
# Pre 80, Post 25, 4 hours, 3L UF, 70kg
kt_v_dialysis(80, 25, 4, 3, 70)
# Example 2: Inadequate Dialysis
# Pre 80, Post 40, 3 hours, 2L UF, 80kg
kt_v_dialysis(80, 40, 3, 2, 80)
LACE Index for Readmission
Description
Calculates the LACE Index to predict the risk of unplanned readmission or death within 30 days after hospital discharge. The score is based on Length of stay, Acuity of admission, Comorbidities (Charlson Index), and Emergency department visits in the previous 6 months.
Usage
lace_readmission_index(length_of_stay_days, acute_admission,
charlson_comorbidity_index, ed_visits_6months)
Arguments
length_of_stay_days |
Numeric. Length of stay in days. <1: 0 pts. 1: 1 pt. 2: 2 pts. 3: 3 pts. 4-6: 4 pts. 7-13: 5 pts. >=14: 7 pts. |
acute_admission |
Numeric (0 or 1). Was the admission acute/emergent? (1 = Yes, +3 pts). |
charlson_comorbidity_index |
Numeric. The patient's Charlson Comorbidity Index score. 0: 0 pts. 1: 1 pt. 2: 2 pts. 3: 3 pts. >=4: 5 pts. |
ed_visits_6months |
Numeric. Number of ED visits in the 6 months prior to admission (excluding the index admission). 0: 0 pts. 1: 1 pt. 2: 2 pts. 3: 3 pts. >=4: 4 pts. |
Value
A list containing:
LACE_Score |
The calculated total score (Range 0-19). |
Risk_Category |
Classification (Low 0-4, Moderate 5-9, High >=10). |
Est_30_Day_Readmission_Risk |
Estimated probability of readmission/death. |
References
van Walraven C, Dhalla IA, Bell C, et al. Derivation and validation of an index to predict early death or unplanned readmission after discharge from hospital to the community. CMAJ. 2010;182(6):551-557. doi:10.1503/cmaj.091117
Examples
# Example 1: High Risk
# 5 day stay (+4), Acute (+3), CCI 5 (+5), 2 ED visits (+2)
# Score = 14
lace_readmission_index(5, 1, 5, 2)
# Example 2: Low Risk
# 2 day stay (+2), Elective (0), CCI 0 (0), 0 ED visits (0)
# Score = 2
lace_readmission_index(2, 0, 0, 0)
Los Angeles Motor Scale (LAMS)
Description
Calculates the LAMS score, a prehospital stroke severity scale designed to identify patients with Large Vessel Occlusion (LVO) who may benefit from endovascular thrombectomy. The score assesses three motor domains: Facial Droop, Arm Drift, and Grip Strength.
Usage
lams_stroke_score(facial_droop, arm_drift, grip_strength)
Arguments
facial_droop |
Numeric (0 or 1). 0: Absent. 1: Present. |
arm_drift |
Numeric (0-2). 0: Absent. 1: Drifts down. 2: Falls rapidly. |
grip_strength |
Numeric (0-2). 0: Normal. 1: Weak grip. 2: No grip. |
Value
A list containing:
LAMS_Score |
The calculated total score (Range 0-5). |
Likelihood_LVO |
Interpretation of LVO risk (Score >= 4 typically suggests LVO). |
Recommendation |
Triage guidance regarding hospital destination. |
References
Llanes JN, Kidwell CS, Starkman S, et al. The Los Angeles Motor Scale (LAMS): a new measure to characterize stroke severity in the field. Prehosp Emerg Care. 2004;8(1):46-50. doi:10.1080/312703002806
Examples
# Example 1: High Risk for LVO
# Facial droop (1), Arm falls rapidly (2), No grip (2)
# Score = 5
lams_stroke_score(1, 2, 2)
# Example 2: Low Risk for LVO
# Facial droop (1), No arm drift (0), Normal grip (0)
# Score = 1
lams_stroke_score(1, 0, 0)
Lansky Play Performance Scale
Description
Retrieves the clinical definition for the Lansky Play Performance Scale score. This tool is designed to assess the functional status of children (typically ages 1-16) with cancer or other serious illnesses based on their ability to engage in play and daily activities.
Usage
lansky_play_performance_scale(score)
Arguments
score |
Numeric. The assigned Lansky score. Must be a multiple of 10 between 0 and 100. |
Value
A list containing:
Lansky_Score |
The input score. |
Definition |
The description of the child's play performance capability. |
Restriction_Level |
General categorization of the functional impairment. |
References
Lansky SB, List MA, Lansky LL, Ritter-Sterr C, Miller DR. The measurement of performance in childhood cancer patients. Cancer. 1987;60(7):1651-1656. doi:10.1002/1097-0142(19871001)60:7<1651::aid-cncr2820600738>3.0.co;2-j
Examples
# Example 1: Active child, tires easily
lansky_play_performance_scale(80)
# Example 2: Mostly in bed
lansky_play_performance_scale(40)
2018 Leibovich Model for Renal Cell Carcinoma (RCC) Prognosis
Description
Calculates the 2018 update to the Leibovich prognostic score for non-metastatic clear cell renal cell carcinoma (ccRCC). This model predicts progression-free survival (metastasis-free) and cancer-specific survival based on pathologic stages, tumor size, nuclear grade, and histologic necrosis.
The scoring stratifies patients into Low Risk (0-2 points), Intermediate Risk (3-5 points), and High Risk (>= 6 points).
Usage
leibovich_2018_rcc(t_stage, n_stage, tumor_size_cm, nuclear_grade, necrosis)
Arguments
t_stage |
String. Pathologic T stage. Accepted values: "1a", "1b", "2a", "2b", "3a", "3b", "3c", "4". (Prefixes "p" or "T" are stripped automatically). |
n_stage |
String. Pathologic N stage. Accepted values: "Nx", "N0", "N1". (Prefixes "p" or "N" are stripped automatically). |
tumor_size_cm |
Numeric. Tumor size in centimeters. |
nuclear_grade |
Numeric. Fuhrman or ISUP nuclear grade (1, 2, 3, or 4). |
necrosis |
Numeric (0 or 1). Presence of histologic tumor necrosis. 0 = No, 1 = Yes. |
Value
A list containing the calculated Score, the associated Risk Group, and lists for Progression/Metastasis-Free Survival and Cancer-Specific Survival probabilities at 1, 3, 5, and 10 years.
References
Leibovich BC, Lohse CM, Cheville JC, et al. Predicting Oncologic Outcomes in Renal Cell Carcinoma After Surgery. Eur Urol. 2018;73(5):772-780. doi:10.1016/j.eururo.2018.01.005
Examples
# Example 1: High Risk Patient
# pT3a, N0, 11cm tumor, Grade 4, with Necrosis
leibovich_2018_rcc("3a", "N0", 11, 4, 1)
# Example 2: Low Risk Patient
# pT1a, Nx, 4cm tumor, Grade 2, No Necrosis
leibovich_2018_rcc("T1a", "Nx", 4, 2, 0)
Leiden Clinical Prediction Rule for Undifferentiated Arthritis
Description
Calculates the Leiden Prediction Rule score to estimate the likelihood that a patient with recent-onset undifferentiated arthritis will progress to Rheumatoid Arthritis (RA) within one year. The score uses clinical, serological, and demographic factors to stratify risk.
Usage
leiden_arthritis_prediction(age_years, sex, distribution_small_hands_feet,
distribution_symmetric, morning_stiffness_severity,
tender_joint_count, swollen_joint_count, crp_mg_dl,
rf_positive, acpa_positive)
Arguments
age_years |
Numeric. Patient age in years. (0.02 points per year). |
sex |
String. Patient sex ("Male" or "Female"). (Female adds 1 point). |
distribution_small_hands_feet |
Numeric (0 or 1). Involvement of small joints of hands or feet? (1 = Yes, +0.5 pts). |
distribution_symmetric |
Numeric (0 or 1). Symmetric distribution of arthritis? (1 = Yes, +0.5 pts). |
morning_stiffness_severity |
Numeric (0 or 1). Morning stiffness >= 1 hour? (or score on VAS >= 26mm). (1 = Yes, +1 pt). |
tender_joint_count |
Numeric. Number of tender joints (0-68). 1-3 joints: +0.5 pts. 4-10 joints: +1 pt. >=11 joints: +1.5 pts. Note: This logic is simplified in many calculators; original paper bins joint counts: 1-3 (+0.5), 4-10 (+1), >10 (+1.5). |
swollen_joint_count |
Numeric. Number of swollen joints (0-66). 1-3 joints: +0.5 pts. 4-10 joints: +1 pt. >=11 joints: +1.5 pts. |
crp_mg_dl |
Numeric. C-Reactive Protein level. (>= 5 mg/L or 0.5 mg/dL adds 1.5 pts. Note input unit here is mg/dL?). *Correction*: Standard input is typically mg/L or mg/dL. Common cutoff is CRP >= 5 mg/L (which is 0.5 mg/dL). Assuming standard "elevated" check. |
rf_positive |
Numeric (0 or 1). Rheumatoid Factor positive? (1 = Yes, +1 pt). |
acpa_positive |
Numeric (0 or 1). Anti-Citrullinated Protein Antibody (ACPA/Anti-CCP) positive? (1 = Yes, +2 pts). |
Value
A list containing:
Leiden_Score |
The calculated risk score (Range 0-14). |
Risk_Category |
Classification (Low, Intermediate, High). |
Progression_Probability_1yr |
Estimated probability of progression to RA. |
References
van der Helm-van Mil AH, le Cessie S, van Dongen H, et al. A prediction rule for disease outcome in patients with recent-onset undifferentiated arthritis: how to guide individual treatment decisions. Arthritis Rheum. 2007;56(2):433-440. doi:10.1002/art.22380
Examples
# Example 1: High Risk
# 50yo Female (+1+1), Small joints (+0.5), Sym (+0.5), Stiffness (+1),
# 5 tender (+1), 5 swollen (+1), CRP high (+1.5), RF (+1), ACPA (+2)
# Score approx 10.5
leiden_arthritis_prediction(50, "female", 1, 1, 1, 5, 5, 10, 1, 1)
# Example 2: Low Risk
# 40yo Male, Large joint (0), Asym (0), No stiff (0), 1 tender (0.5), 1 swollen (0.5), Normal labs
# Score = 0.8 + 0 + 0 + 0 + 0 + 0.5 + 0.5 + 0 = 1.8
leiden_arthritis_prediction(40, "male", 0, 0, 0, 1, 1, 0, 0, 0)
LENT Prognostic Score for Malignant Pleural Effusion
Description
Calculates the LENT score (Pleural fluid LDH, ECOG performance status, Neutrophil-to-lymphocyte ratio, Tumor type) to predict survival in patients with malignant pleural effusion. It stratifies patients into Low, Moderate, and High risk groups.
Usage
lent_prognostic_score(pleural_ldh, ecog_score, serum_nlr, tumor_type)
Arguments
pleural_ldh |
Numeric. Lactate dehydrogenase level in pleural fluid (IU/L). (> 1500 IU/L adds 1 point). |
ecog_score |
Numeric (0-4). Eastern Cooperative Oncology Group performance status. 0: 0 pts. 1: 1 pt. 2: 2 pts. 3-4: 3 pts. |
serum_nlr |
Numeric. Serum neutrophil-to-lymphocyte ratio. (> 9 adds 1 point). |
tumor_type |
String. Primary tumor type. "mesothelioma", "hematologic": 0 pts (Low risk). "breast", "gynecologic", "renal", "sarcoma": 1 pt (Moderate risk). "lung", "other": 2 pts (High risk). |
Value
A list containing:
LENT_Score |
The calculated total score (Range 0-7). |
Risk_Category |
Classification (Low 0-1, Moderate 2-4, High 5-7). |
Median_Survival |
Estimated median survival time in days/months. |
References
Clive AO, Kahan BC, Hooper CE, et al. Predicting survival in malignant pleural effusion: development and validation of the LENT prognostic score. Thorax. 2014;69(12):1098-1104. doi:10.1136/thoraxjnl-2014-205285
Examples
# Example 1: Low Risk
# LDH 1000, ECOG 0, NLR 5, Breast Cancer
# Score = 0 + 0 + 0 + 1 = 1
lent_prognostic_score(1000, 0, 5, "breast")
# Example 2: High Risk
# LDH 2000 (+1), ECOG 3 (+3), NLR 12 (+1), Lung Cancer (+2)
# Score = 7
lent_prognostic_score(2000, 3, 12, "lung")
Weight-Based Levothyroxine Dose Calculator
Description
Calculates the recommended starting dose of levothyroxine for adults with hypothyroidism. The calculation is based on ideal or actual body weight (typically 1.6 mcg/kg for full replacement), adjusted for age, history of coronary artery disease (CAD), and pregnancy status.
Usage
levothyroxine_dosing_calculator(weight_kg, age_years, history_cad,
pregnant_trimester = "not_pregnant",
tsh_level = NA)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. (Ideally Lean Body Weight if obese). |
age_years |
Numeric. Patient age in years. |
history_cad |
Numeric (0 or 1). History of Coronary Artery Disease. (1 = Yes). |
pregnant_trimester |
String. Pregnancy status. Options: "not_pregnant", "first", "second", "third". |
tsh_level |
Numeric (Optional). Serum TSH level to distinguish subclinical vs overt hypothyroidism. |
Value
A list containing:
Recommended_Starting_Dose_mcg |
The calculated daily dose in micrograms. |
Guidance |
Clinical context for the dosing recommendation. |
References
Jonklaas J, Bianco AC, Bauer AJ, et al. Guidelines for the treatment of hypothyroidism: prepared by the american thyroid association task force on thyroid hormone replacement. Thyroid. 2014;24(12):1670-1751. doi:10.1089/thy.2014.0028
Examples
# Example 1: Healthy Young Adult
# 70kg, 30yo, No CAD
# Dose = 1.6 * 70 = 112 mcg
levothyroxine_dosing_calculator(70, 30, 0)
# Example 2: Elderly with CAD
# 70kg, 75yo, CAD History (1)
# Dose = 12.5 mcg (Start low)
levothyroxine_dosing_calculator(70, 75, 1)
Licurse Score for Renal Ultrasound in AKI
Description
Calculates the Licurse Score to stratify the utility of renal ultrasonography (RUS) in patients presenting with Acute Kidney Injury (AKI). The score identifies patients at low risk for hydronephrosis (post-renal obstruction), potentially reducing unnecessary imaging.
Usage
licurse_renal_ultrasound_score(age_ge_65, male_sex, history_hydronephrosis,
history_chf)
Arguments
age_ge_65 |
Numeric (0 or 1). Is the patient 65 years of age or older? (1 = Yes, +1 point). |
male_sex |
Numeric (0 or 1). Is the patient male? (1 = Yes, +1 point). |
history_hydronephrosis |
Numeric (0 or 1). Does the patient have a known history of hydronephrosis? (1 = Yes, +1 point). |
history_chf |
Numeric (0 or 1). Does the patient have a history of Congestive Heart Failure? (1 = Yes, -1 point). |
Value
A list containing:
Licurse_Score |
The calculated score (Range -1 to 3). |
Risk_Category |
Classification of risk (Low, Intermediate, High, Very High). |
Prob_Hydronephrosis |
Estimated probability of detecting hydronephrosis on ultrasound. |
Recommendation |
Guidance on the necessity of imaging. |
References
Licurse A, Kim MC, Dziura J, et al. Renal ultrasonography in the evaluation of acute kidney injury: developing a clinical prediction rule. Arch Intern Med. 2010;170(15):1317-1321. doi:10.1001/archinternmed.2010.240
Examples
# Example 1: Low Risk (No imaging needed)
# 40yo Female, No Hx Hydro, Hx CHF
# Score = 0 + 0 + 0 - 1 = -1
licurse_renal_ultrasound_score(0, 0, 0, 1)
# Example 2: High Risk
# 70yo Male, No Hx Hydro, No CHF
# Score = 1 + 1 + 0 + 0 = 2
licurse_renal_ultrasound_score(1, 1, 0, 0)
Light's Criteria for Pleural Effusion
Description
Applies Light's Criteria to differentiate between transudative and exudative pleural effusions. An effusion is classified as exudative if at least one of the three criteria is met: 1. Pleural fluid protein / Serum protein > 0.5 2. Pleural fluid LDH / Serum LDH > 0.6 3. Pleural fluid LDH > 2/3 * Serum LDH Upper Limit of Normal (ULN)
Usage
lights_criteria_effusion(pleural_protein, serum_protein, pleural_ldh,
serum_ldh, serum_ldh_uln)
Arguments
pleural_protein |
Numeric. Pleural fluid protein level (g/dL). |
serum_protein |
Numeric. Serum protein level (g/dL). |
pleural_ldh |
Numeric. Pleural fluid Lactate Dehydrogenase (LDH) level (U/L). |
serum_ldh |
Numeric. Serum Lactate Dehydrogenase (LDH) level (U/L). |
serum_ldh_uln |
Numeric. The laboratory's upper limit of normal for serum LDH (U/L). |
Value
A list containing:
Classification |
"Exudative" or "Transudative". |
Criteria_Met |
A list of the specific criteria that triggered the exudative classification. |
Calculated_Values |
The calculated ratios and thresholds used. |
References
Light RW, Macgregor MI, Luchsinger PC, Ball WC Jr. Pleural effusions: the diagnostic separation of transudates and exudates. Ann Intern Med. 1972;77(4):507-513. doi:10.7326/0003-4819-77-4-507
Examples
# Example 1: Exudative (High Protein Ratio)
# P-Prot 4.0, S-Prot 6.0 (Ratio 0.66), LDH normal
lights_criteria_effusion(4.0, 6.0, 100, 200, 250)
# Example 2: Transudative
# P-Prot 2.0, S-Prot 7.0 (Ratio 0.28), P-LDH 80, S-LDH 200, ULN 250
# All ratios low
lights_criteria_effusion(2.0, 7.0, 80, 200, 250)
Lille Model for Alcoholic Hepatitis
Description
Calculates the Lille Model score to predict 6-month mortality in patients with severe alcoholic hepatitis treated with steroids. It is used at Day 7 of treatment to determine whether the patient is a "responder" or "non-responder," helping guide the decision to continue or stop corticosteroids.
Usage
lille_model_score(age, renal_insufficiency, albumin, bilirubin_day0,
bilirubin_day7, pt_seconds, bilirubin_units = "mg/dL",
albumin_units = "g/dL")
Arguments
age |
Numeric. Patient age in years. |
renal_insufficiency |
Numeric (0 or 1). Creatinine > 1.3 mg/dL (> 115 µmol/L) or CrCl < 40 mL/min. (1 = Yes). |
albumin |
Numeric. Serum albumin level. |
bilirubin_day0 |
Numeric. Total bilirubin on Day 0 (start of treatment). |
bilirubin_day7 |
Numeric. Total bilirubin on Day 7 of treatment. |
pt_seconds |
Numeric. Prothrombin Time in seconds. |
bilirubin_units |
String. Units for bilirubin. "mg/dL" (default) or "umol/L". |
albumin_units |
String. Units for albumin. "g/dL" (default) or "g/L". |
Value
A list containing:
Lille_Model_Score |
The calculated probability score (0-1). |
Interpretation |
Clinical guidance (Responder < 0.45, Non-responder >= 0.45). |
References
Louvet A, Naveau S, Abdelnour M, et al. The Lille model: a new tool for therapeutic strategy in patients with severe alcoholic hepatitis treated with steroids. Hepatology. 2007;45(6):1348-1354. doi:10.1002/hep.21607
Examples
# Example 1: Responder
# Age 45, No Renal, Alb 3.5 g/dL, Bili 10->5 mg/dL, PT 15s
lille_model_score(45, 0, 3.5, 10, 5, 15)
# Example 2: Non-Responder
# Age 55, Renal Yes, Alb 2.5 g/dL, Bili 15->14 mg/dL, PT 25s
lille_model_score(55, 1, 2.5, 15, 14, 25)
Lung Injury Prediction Score (LIPS)
Description
Calculates the Lung Injury Prediction Score (LIPS) to identify patients at high risk for developing Acute Lung Injury (ALI) or Acute Respiratory Distress Syndrome (ARDS). The score sums points for predisposing conditions (like shock, aspiration, sepsis) and risk modifiers (like alcohol use, obesity, and vital signs). A score of 4 or greater typically indicates high risk.
Usage
lips_score(shock, aspiration, sepsis, pneumonia, high_risk_surgery,
high_risk_trauma, alcohol_abuse, obesity_bmi_gt_30, hypoalbuminemia,
chemotherapy, fio2_gt_0_35_or_4l, tachypnea_rr_gt_30, spo2_lt_95,
acidosis_ph_lt_7_35, diabetes_mellitus)
Arguments
shock |
Numeric (0 or 1). Presence of shock (Cardiogenic, Septic, or Hypovolemic). (1 = Yes, +2 pts). |
aspiration |
Numeric (0 or 1). Aspiration. (1 = Yes, +2 pts). |
sepsis |
Numeric (0 or 1). Sepsis. (1 = Yes, +1 pt). |
pneumonia |
Numeric (0 or 1). Pneumonia. (1 = Yes, +1.5 pts). |
high_risk_surgery |
Numeric (0 or 1). High-risk surgery (Aortic vascular, Cardiac, Emergency, Spine). (1 = Yes, +2 pts). |
high_risk_trauma |
Numeric (0 or 1). High-risk trauma (TBI, Smoke inhalation, Near drowning, Lung contusion, Multiple fractures). (1 = Yes, +2 pts). |
alcohol_abuse |
Numeric (0 or 1). Alcohol abuse. (1 = Yes, +1 pt). |
obesity_bmi_gt_30 |
Numeric (0 or 1). Obesity (BMI > 30). (1 = Yes, +1 pt). |
hypoalbuminemia |
Numeric (0 or 1). Hypoalbuminemia (Albumin < 3.5 g/dL). (1 = Yes, +1 pt). |
chemotherapy |
Numeric (0 or 1). Chemotherapy. (1 = Yes, +1 pt). |
fio2_gt_0_35_or_4l |
Numeric (0 or 1). FiO2 > 0.35 or > 4 L/min O2 (sometimes noted as >2 L/min in variations). (1 = Yes, +2 pts). |
tachypnea_rr_gt_30 |
Numeric (0 or 1). Respiratory rate > 30 bpm. (1 = Yes, +1.5 pts). |
spo2_lt_95 |
Numeric (0 or 1). SpO2 < 95%. (1 = Yes, +1 pt). |
acidosis_ph_lt_7_35 |
Numeric (0 or 1). Acidosis (pH < 7.35). (1 = Yes, +1 pt). |
diabetes_mellitus |
Numeric (0 or 1). Diabetes Mellitus. (1 = Yes, -1 pt). Note: Diabetes is protective in this model. |
Value
A list containing:
LIPS_Score |
The calculated total score (Range -1 to >20). |
Risk_Category |
"Low Risk" (< 4) or "High Risk" (>= 4). |
Recommendation |
Clinical guidance for monitoring. |
References
Gajic O, Dabbagh O, Park PK, et al. Early identification of patients at risk of acute lung injury: evaluation of lung injury prediction score in a multicenter cohort study. Am J Respir Crit Care Med. 2011;183(4):462-470. doi:10.1164/rccm.201004-0549OC
Examples
# Example 1: High Risk
# Shock (+2), Sepsis (+1), Acidosis (+1), Hypoalbuminemia (+1)
# Score = 5
lips_score(1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0)
# Example 2: Low Risk
# Pneumonia (+1.5), Diabetes (-1), No other factors
# Score = 0.5
lips_score(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)
Liver Decompensation Risk after Hepatectomy for HCC
Description
Calculates the risk of liver decompensation and liver-related mortality after partial hepatectomy for Hepatocellular Carcinoma (HCC). This hierarchical model stratifies patients into Low, Intermediate, and High risk categories based on the presence of portal hypertension, the extent of resection, and the MELD score.
Usage
liver_decompensation_risk_hcc(portal_hypertension, extent_hepatectomy,
meld_score)
Arguments
portal_hypertension |
Numeric (0 or 1). Presence of clinically significant portal hypertension (e.g., esophageal varices, splenomegaly with platelets <100,000/uL). (1 = Yes). |
extent_hepatectomy |
String. Planned extent of liver resection. "minor": Removal of < 3 adjacent segments. "major": Removal of >= 3 adjacent segments. |
meld_score |
Numeric. Model for End-Stage Liver Disease (MELD) score (or MELD-Na). Threshold for risk stratification is > 9. |
Value
A list containing:
Risk_Category |
Classification (Low, Intermediate, High). |
Est_Liver_Decompensation_Rate |
Estimated probability of postoperative liver decompensation. |
Est_Liver_Related_Mortality |
Estimated probability of liver-related mortality. |
References
Citterio D, Facciorusso A, Sposito C, et al. Hierarchic Interaction of Factors Associated With Liver Decompensation After Resection for Hepatocellular Carcinoma. JAMA Surg. 2016;151(10):908-916. doi:10.1001/jamasurg.2016.1121
Examples
# Example 1: High Risk
# Portal HTN, Major Resection
liver_decompensation_risk_hcc(1, "major", 8)
# Example 2: Intermediate Risk
# No Portal HTN, Major Resection
liver_decompensation_risk_hcc(0, "major", 8)
# Example 3: Low Risk
# No Portal HTN, Minor Resection, MELD 8
liver_decompensation_risk_hcc(0, "minor", 8)
Local Anesthetic Dosing Calculator
Description
Calculates the maximum safe dose (in milligrams and milliliters) of common local anesthetics based on patient weight, specific drug properties, and the presence of epinephrine. It accounts for both weight-based limits and absolute maximum total dose limits.
Usage
local_anesthetic_dosing(weight_kg, anesthetic_type, concentration_percent,
with_epinephrine = 0)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. |
anesthetic_type |
String. The generic name of the anesthetic. Supported: "lidocaine", "bupivacaine", "mepivacaine", "ropivacaine", "procaine", "chloroprocaine", "tetracaine". |
concentration_percent |
Numeric. The concentration of the solution in percent (e.g., 1 for 1%, 0.5 for 0.5%). |
with_epinephrine |
Numeric (0 or 1). Is the anesthetic mixed with epinephrine? (1 = Yes, 0 = No). Presence of epinephrine typically increases the maximum safe dose for certain agents (e.g., Lidocaine, Mepivacaine) by vasoconstriction, delaying systemic absorption. |
Value
A list containing:
Max_Dose_mg |
The calculated maximum safe dose in milligrams. |
Max_Volume_mL |
The calculated maximum safe volume in milliliters. |
Constraint |
Indicates whether the dose was limited by the weight-based calculation or the absolute maximum ceiling. |
References
Rosenberg PH, Veering BT, Urmey WF. Maximum recommended doses of local anesthetics: a multifactorial concept. Reg Anesth Pain Med. 2004;29(6):564-575. doi:10.1016/j.rapm.2004.08.003
Examples
# Example 1: Lidocaine w/ Epi for 70kg adult (1% solution)
# Max dose 7 mg/kg -> 490 mg. Max Vol = 490 / 10 = 49 mL.
local_anesthetic_dosing(70, "lidocaine", 1, 1)
# Example 2: Bupivacaine Plain for 50kg patient (0.25% solution)
# Max dose 2.5 mg/kg -> 125 mg. Conc = 2.5 mg/mL. Max Vol = 125 / 2.5 = 50 mL.
local_anesthetic_dosing(50, "bupivacaine", 0.25, 0)
Los Angeles (LA) Grading of Esophagitis
Description
Retrieves the definition for the Los Angeles (LA) Classification system for grading the severity of reflux esophagitis. This widely accepted endoscopic grading system stratifies esophagitis into four grades (A through D) based on the extent of mucosal breaks.
Usage
los_angeles_esophagitis_grade(grade)
Arguments
grade |
String. The LA Grade observed. Options: "grade_a", "grade_b", "grade_c", "grade_d". |
Value
A list containing:
LA_Grade |
The formatted grade string (e.g., "Grade A"). |
Definition |
The detailed endoscopic description of the grade. |
References
Lundell LR, Dent J, Bennett JR, et al. Endoscopic assessment of oesophagitis: clinical and functional correlates and further validation of the Los Angeles classification. Gut. 1999;45(2):172-180. doi:10.1136/gut.45.2.172
Examples
# Example 1: Mild Esophagitis
los_angeles_esophagitis_grade("grade_a")
# Example 2: Severe Esophagitis (Circumferential)
los_angeles_esophagitis_grade("grade_d")
LRINEC Score for Necrotizing Soft Tissue Infection
Description
Calculates the Laboratory Risk Indicator for Necrotizing Fasciitis (LRINEC) score. This tool uses six independent laboratory predictors (CRP, WBC, Hemoglobin, Sodium, Creatinine, Glucose) to distinguish necrotizing soft tissue infections from severe cellulitis or abscesses.
Usage
lrinec_score_necrotizing_infection(crp_mg_dl, wbc_count, hemoglobin_g_dl,
sodium, creatinine, glucose_mg_dl,
creatinine_units = "mg/dL",
glucose_units = "mg/dL")
Arguments
crp_mg_dl |
Numeric. C-Reactive Protein level in mg/dL. (>= 15 mg/dL adds 4 points). |
wbc_count |
Numeric. White Blood Cell count in x10^3/uL (or x10^9/L). (<15: 0, 15-25: 1, >25: 2). |
hemoglobin_g_dl |
Numeric. Hemoglobin level in g/dL. (>13.5: 0, 11-13.5: 1, <11: 2). |
sodium |
Numeric. Serum Sodium level in mEq/L. (<135: 2 pts). |
creatinine |
Numeric. Serum Creatinine level. (>1.6 mg/dL adds 2 pts). |
glucose_mg_dl |
Numeric. Serum Glucose level. (>180 mg/dL adds 1 pt). |
creatinine_units |
String. Units for creatinine. "mg/dL" (default) or "micromol/L". |
glucose_units |
String. Units for glucose. "mg/dL" (default) or "mmol/L". |
Value
A list containing:
LRINEC_Score |
The calculated score (Range 0-13). |
Risk_Category |
Classification (Low <=5, Intermediate 6-7, High >=8). |
Est_Probability_NSTI |
Estimated probability of Necrotizing Soft Tissue Infection. |
References
Wong CH, Khin LW, Heng KS, Tan KC, Low CO. The LRINEC (Laboratory Risk Indicator for Necrotizing Fasciitis) score: a tool for distinguishing necrotizing fasciitis from other soft tissue infections. Crit Care Med. 2004;32(7):1535-1541. doi:10.1097/01.ccm.0000129486.35458.7d
Examples
# Example 1: High Risk
# CRP 20 (+4), WBC 28 (+2), Hb 10 (+2), Na 130 (+2), Cr 1.0, Gluc 200 (+1)
# Score = 11
lrinec_score_necrotizing_infection(20, 28, 10, 130, 1.0, 200)
# Example 2: Low Risk
# CRP 5 (0), WBC 12 (0), Hb 14 (0), Na 140 (0), Cr 0.9, Gluc 100 (0)
# Score = 0
lrinec_score_necrotizing_infection(5, 12, 14, 140, 0.9, 100)
MACOCHA Score for Difficult Intubation in ICU
Description
Calculates the MACOCHA score to predict the risk of difficult endotracheal intubation specifically in critically ill patients in the Intensive Care Unit (ICU). A score of 3 or greater identifies patients at high risk for difficult intubation.
Usage
macocha_score(mallampati_iii_iv, apnea_syndrome, cervical_spine_limited,
mouth_opening_lt_3cm, coma_gcs_lt_8, hypoxia_severe,
non_anesthesiologist)
Arguments
mallampati_iii_iv |
Numeric (0 or 1). Mallampati Score III or IV. (1 = Yes, +5 points). |
apnea_syndrome |
Numeric (0 or 1). Obstructive Sleep Apnea Syndrome (OSAS). (1 = Yes, +2 points). |
cervical_spine_limited |
Numeric (0 or 1). Reduced mobility of the cervical spine. (1 = Yes, +1 point). |
mouth_opening_lt_3cm |
Numeric (0 or 1). Limited mouth opening (< 3 cm). (1 = Yes, +1 point). |
coma_gcs_lt_8 |
Numeric (0 or 1). Coma (Glasgow Coma Scale < 8). (1 = Yes, +1 point). |
hypoxia_severe |
Numeric (0 or 1). Severe hypoxia (SpO2 < 80% despite preoxygenation). (1 = Yes, +1 point). |
non_anesthesiologist |
Numeric (0 or 1). Operator is a non-anesthesiologist. (1 = Yes, +1 point). |
Value
A list containing:
MACOCHA_Score |
The calculated score (Range 0-12). |
Risk_Category |
"Low Risk" (Score 0-2) or "High Risk" (Score >= 3). |
Recommendation |
Clinical guidance for airway management preparation. |
References
De Jong A, Molinari N, Terzi N, et al. Early identification of patients at risk of difficult intubation in the intensive care unit: development and validation of the MACOCHA score in a multicenter cohort study. Am J Respir Crit Care Med. 2013;187(8):832-839. doi:10.1164/rccm.201210-1851OC
Examples
# Example 1: High Risk
# Mallampati III (+5), Coma (+1)
# Score = 6
macocha_score(1, 0, 0, 0, 1, 0, 0)
# Example 2: Low Risk
# OSAS (+2), No other factors
# Score = 2
macocha_score(0, 1, 0, 0, 0, 0, 0)
Maddrey's Discriminant Function for Alcoholic Hepatitis
Description
Calculates Maddrey's Discriminant Function (MDF) score to assess the severity and prognosis of alcoholic hepatitis. A score of 32 or higher identifies patients with a high risk of short-term mortality who may benefit from corticosteroid therapy.
Usage
maddreys_discriminant_function(pt_patient_seconds, pt_control_seconds,
bilirubin, bilirubin_units = "mg/dL")
Arguments
pt_patient_seconds |
Numeric. Patient's Prothrombin Time in seconds. |
pt_control_seconds |
Numeric. Control Prothrombin Time in seconds (typically around 12-14 seconds). |
bilirubin |
Numeric. Total Bilirubin level. |
bilirubin_units |
String. Units for bilirubin input. Options: "mg/dL" (default) or "umol/L". |
Value
A list containing:
Maddrey_DF_Score |
The calculated score. |
Prognosis |
Interpretation of severity. |
Mortality_Risk |
Estimated risk of short-term mortality. |
Recommendation |
Guidance on treatment considerations (e.g., corticosteroids). |
References
Maddrey WC, Boitnott JK, Bedine MS, et al. Corticosteroid therapy of alcoholic hepatitis. Gastroenterology. 1978;75(2):193-199.
Examples
# Example 1: Severe (Score >= 32)
# PT 22s (Control 12s), Bili 10 mg/dL
# Score = 4.6*(22-12) + 10 = 56
maddreys_discriminant_function(22, 12, 10)
# Example 2: Mild
# PT 14s (Control 12s), Bili 5 mg/dL
# Score = 4.6*(14-12) + 5 = 14.2
maddreys_discriminant_function(14, 12, 5)
Montgomery-Asberg Depression Rating Scale (MADRS)
Description
Calculates the MADRS score, a 10-item clinician-rated scale used to measure the severity of depressive episodes in patients with mood disorders. Each item is rated on a 0-6 scale, yielding a total score from 0 to 60. It is widely used to monitor treatment response.
Usage
madrs_depression_score(apparent_sadness, reported_sadness, inner_tension,
reduced_sleep, reduced_appetite, concentration_difficulties,
lassitude, inability_to_feel, pessimistic_thoughts,
suicidal_thoughts)
Arguments
apparent_sadness |
Numeric (0-6). Despondency, gloom, and despair (more than just ordinary transient low spirits) reflected in speech, facial expression, and posture. |
reported_sadness |
Numeric (0-6). Representing reports of depressed mood, regardless of whether it is reflected in appearance or not. |
inner_tension |
Numeric (0-6). Representing feelings of ill-defined discomfort, edginess, inner turmoil, mental tension mounting to either panic, dread, or anguish. |
reduced_sleep |
Numeric (0-6). Representing a subjective experience of reduced duration or depth of sleep compared to the subject's own normal pattern when well. |
reduced_appetite |
Numeric (0-6). Representing the feeling of a loss of appetite compared with when well. |
concentration_difficulties |
Numeric (0-6). Representing difficulties in collecting one's thoughts mounting to incapacitating lack of concentration. |
lassitude |
Numeric (0-6). Representing a difficulty getting started or slowness initiating and performing everyday activities. |
inability_to_feel |
Numeric (0-6). Representing the subjective experience of reduced interest in the surroundings, or activities that normally give pleasure. |
pessimistic_thoughts |
Numeric (0-6). Representing thoughts of guilt, inferiority, self-reproach, sinfulness, remorse, and ruin. |
suicidal_thoughts |
Numeric (0-6). Representing the feeling that life is not worth living, that a natural death would be welcome, suicidal thoughts, and preparations for suicide. |
Value
A list containing:
MADRS_Score |
The calculated total score (Range 0-60). |
Severity_Category |
Interpretation (Normal 0-6, Mild 7-19, Moderate 20-34, Severe >34). |
References
Montgomery SA, Asberg M. A new depression scale designed to be sensitive to change. Br J Psychiatry. 1979;134:382-389. doi:10.1192/bjp.134.4.382
Examples
# Example 1: Moderate Depression
# Most items scored 3 (Moderate)
madrs_depression_score(3, 3, 3, 3, 3, 3, 3, 3, 3, 3)
# Example 2: Severe Depression
# High scores across emotional and vegetative symptoms
madrs_depression_score(5, 5, 4, 4, 2, 4, 5, 4, 4, 3)
MAGGIC Heart Failure Risk Calculator
Description
Calculates the MAGGIC (Meta-Analysis Global Group in Chronic Heart Failure) Risk Score to predict 1-year and 3-year mortality in patients with heart failure (both reduced and preserved ejection fraction).
Usage
maggic_risk_score(age, lvef, sbp, bmi, creatinine, nyha_class, sex, smoker,
diabetes, copd, heart_failure_duration_gt_18mo, beta_blocker_use,
acei_arb_use, creatinine_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. |
lvef |
Numeric. Left Ventricular Ejection Fraction (%). |
sbp |
Numeric. Systolic Blood Pressure (mmHg). |
bmi |
Numeric. Body Mass Index (kg/m^2). |
creatinine |
Numeric. Serum Creatinine level. |
nyha_class |
Numeric (1-4). NYHA Functional Class. |
sex |
String. "Male" or "Female". |
smoker |
Numeric (0 or 1). Current smoker? (1 = Yes). |
diabetes |
Numeric (0 or 1). History of Diabetes? (1 = Yes). |
copd |
Numeric (0 or 1). History of COPD? (1 = Yes). |
heart_failure_duration_gt_18mo |
Numeric (0 or 1). Diagnosed with Heart Failure > 18 months ago? (1 = Yes). |
beta_blocker_use |
Numeric (0 or 1). Currently taking a Beta-blocker? (1 = Yes). |
acei_arb_use |
Numeric (0 or 1). Currently taking an ACE inhibitor or ARB? (1 = Yes). |
creatinine_units |
String. Units for creatinine. "mg/dL" (default) or "micromol/L" (or "umol/L"). |
Value
A list containing:
MAGGIC_Risk_Score |
The calculated total integer score. |
One_Year_Mortality_Risk |
Estimated probability of death at 1 year. |
Three_Year_Mortality_Risk |
Estimated probability of death at 3 years. |
References
Pocock SJ, Ariti CA, McMurray JJ, et al. Predicting survival in heart failure: a risk score based on 39 372 patients from 30 studies. Eur Heart J. 2013;34(19):1404-1413. doi:10.1093/eurheartj/ehs337
Examples
# Example 1: High Risk
# 75yo, EF 25, SBP 105, BMI 22, Cr 1.8, NYHA III, Male, COPD, No meds
maggic_risk_score(75, 25, 105, 22, 1.8, 3, "male", 0, 0, 1, 1, 0, 0)
# Example 2: Low Risk
# 50yo, EF 45, SBP 130, BMI 30, Cr 1.0, NYHA I, Female, No comorbidities, On meds
maggic_risk_score(50, 45, 130, 30, 1.0, 1, "female", 0, 0, 0, 0, 1, 1)
Maintenance Fluids Calculator (4-2-1 Rule)
Description
Calculates the maintenance fluid requirement for pediatric and adult patients using the Holliday-Segar (4-2-1) rule. This method estimates the hourly IV fluid rate required to maintain hydration based on body weight.
Usage
maintenance_fluids_dosing(weight_kg)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. |
Details
The 4-2-1 Rule calculates the hourly rate as follows:
First 10 kg: 4 mL/kg/hr
Next 10 kg (11-20 kg): 2 mL/kg/hr
Each kg above 20 kg: 1 mL/kg/hr
Value
A list containing:
Hourly_Rate_mL_hr |
The calculated maintenance rate in mL per hour. |
Daily_Volume_mL_day |
The total fluid volume required over 24 hours. |
References
Holliday MA, Segar WE. The maintenance need for water in parenteral fluid therapy. Pediatrics. 1957;19(5):823-832.
Examples
# Example 1: Adult (70 kg)
# 40 + 20 + 50 = 110 mL/hr
maintenance_fluids_dosing(70)
# Example 2: Child (15 kg)
# 40 + (5 * 2) = 50 mL/hr
maintenance_fluids_dosing(15)
Major Depression Index (MDI)
Description
Calculates the Major Depression Index (MDI) score, a self-rating scale used to measure the severity of depressive symptoms. It evaluates 10 items (with sub-items for psychomotor and appetite changes) on a 0-5 scale based on frequency over the last 2 weeks. The scoring logic takes the maximum value for items 8 (restlessness vs. slowed down) and 10 (reduced vs. increased appetite).
Usage
major_depression_index(low_spirits, loss_of_interest, lacking_energy,
self_confidence, guilt, suicidal_ideation, concentration,
restlessness, slowed_down, sleep_trouble, reduced_appetite,
increased_appetite)
Arguments
low_spirits |
Numeric (0-5). Frequency of feeling low in spirits or sad. |
loss_of_interest |
Numeric (0-5). Frequency of losing interest in daily activities. |
lacking_energy |
Numeric (0-5). Frequency of lacking energy/strength. |
self_confidence |
Numeric (0-5). Frequency of feeling less self-confident. |
guilt |
Numeric (0-5). Frequency of having a bad conscience or feelings of guilt. |
suicidal_ideation |
Numeric (0-5). Frequency of feeling that life isn't worth living. |
concentration |
Numeric (0-5). Frequency of trouble concentrating. |
restlessness |
Numeric (0-5). Frequency of feeling very restless (8a). |
slowed_down |
Numeric (0-5). Frequency of feeling subdued or slowed down (8b). |
sleep_trouble |
Numeric (0-5). Frequency of trouble sleeping at night. |
reduced_appetite |
Numeric (0-5). Frequency of reduced appetite (10a). |
increased_appetite |
Numeric (0-5). Frequency of increased appetite (10b). |
Details
Scoring Key (Frequency over last 2 weeks): 0 = At no time 1 = Some of the time 2 = Slightly less than half the time 3 = Slightly more than half the time 4 = Most of the time 5 = All the time
Value
A list containing:
MDI_Score |
The calculated total score (Range 0-50). |
Severity_Category |
Interpretation (None <20, Mild 20-24, Moderate 25-29, Severe >=30). |
References
Bech P, Rasmussen NA, Olsen LR, Noerholm V, Abildgaard W. The sensitivity and specificity of the Major Depression Inventory, using the Present State Examination as the index of validity. J Affect Disord. 2001;66(2-3):159-164. doi:10.1016/s0165-0327(00)00309-8
Examples
# Example 1: Severe Depression
# All items scored 4 or 5
major_depression_index(5, 5, 4, 4, 5, 2, 4, 5, 0, 4, 0, 5)
# Example 2: Mild Depression
# Scores around 2 or 3
major_depression_index(2, 3, 2, 2, 1, 0, 2, 2, 0, 3, 3, 0)
MALT Lymphoma International Prognostic Index (MALT-IPI)
Description
Calculates the MALT-IPI score to predict event-free survival (EFS) in patients with MALT lymphoma. The index uses three adverse prognostic factors: Age >= 70 years, Ann Arbor Stage III or IV, and elevated serum LDH.
Usage
malt_ipi_score(age, ann_arbor_stage, ldh_elevated)
Arguments
age |
Numeric. Patient age in years. (>= 70 years adds 1 point). |
ann_arbor_stage |
Numeric (1-4). Ann Arbor Stage. (Stage III or IV adds 1 point). |
ldh_elevated |
Numeric (0 or 1). Serum LDH level greater than the upper limit of normal. (1 = Yes, +1 point). |
Value
A list containing:
MALT_IPI_Score |
The calculated score (Range 0-3). |
Risk_Group |
Classification (Low: 0, Intermediate: 1, High: >=2). |
Est_5_Year_Event_Free_Survival |
Estimated 5-year event-free survival probability. |
References
Thieblemont C, Cascín-Medina A, Bertoni F, et al. A MALT lymphoma prognostic index. Blood. 2017;130(12):1409-1417. doi:10.1182/blood-2017-03-771915
Examples
# Example 1: High Risk
# 75yo (+1), Stage IV (+1), Normal LDH (0)
# Score = 2
malt_ipi_score(75, 4, 0)
# Example 2: Low Risk
# 60yo (0), Stage I (0), Normal LDH (0)
# Score = 0
malt_ipi_score(60, 1, 0)
Manchester Score for Prognosis in Small Cell Lung Cancer (SCLC)
Description
Calculates the Manchester Score to predict prognosis in patients with Small Cell Lung Cancer (SCLC). The score stratifies patients into Good, Intermediate, or Poor risk groups based on LDH, Sodium, Alkaline Phosphatase, Karnofsky Performance Status, Bicarbonate, and Disease Stage.
Usage
manchester_sclc_score(ldh_level, ldh_uln, sodium, alk_phos_level, alk_phos_uln,
kps, bicarbonate, stage_extensive)
Arguments
ldh_level |
Numeric. Patient's serum Lactate Dehydrogenase level (U/L). |
ldh_uln |
Numeric. Laboratory Upper Limit of Normal for LDH. (Score adds 1 if LDH >= ULN). |
sodium |
Numeric. Serum Sodium level (mmol/L or mEq/L). (Score adds 1 if Na < 132). |
alk_phos_level |
Numeric. Serum Alkaline Phosphatase level (U/L). |
alk_phos_uln |
Numeric. Laboratory Upper Limit of Normal for Alkaline Phosphatase. (Score adds 1 if ALP >= 1.5x ULN). |
kps |
Numeric. Karnofsky Performance Status score (0-100). (Score adds 1 if KPS < 60). |
bicarbonate |
Numeric. Serum Bicarbonate (HCO3) level (mmol/L or mEq/L). (Score adds 1 if HCO3 < 24). |
stage_extensive |
Numeric (0 or 1). Is the disease stage Extensive? (1 = Yes, +1 point; 0 = Limited, 0 points). |
Value
A list containing:
Manchester_Score |
The calculated total score (Range 0-6). |
Prognosis_Group |
Classification (Good 0-1, Intermediate 2-3, Poor 4-6). |
Median_Survival |
Estimated median survival time. |
Two_Year_Survival |
Estimated 2-year survival percentage. |
References
Cerny T, Blair V, Anderson H, et al. Pretreatment prognostic factors and scoring system in 407 small-cell lung cancer patients. Int J Cancer. 1987;39(2):146-149. doi:10.1002/ijc.2910390204
Examples
# Example 1: Good Prognosis
# Normal labs, High KPS, Limited Stage
manchester_sclc_score(150, 250, 140, 80, 120, 90, 26, 0)
# Example 2: Poor Prognosis
# High LDH, Low Na, High ALP, Low KPS, Low HCO3, Extensive Stage
# Score = 6
manchester_sclc_score(300, 250, 130, 200, 100, 50, 20, 1)
Manning Criteria for Diagnosis of Irritable Bowel Syndrome (IBS)
Description
Calculates the Manning Score to estimate the likelihood of Irritable Bowel Syndrome (IBS). The score counts the number of positive symptoms out of six specific gastrointestinal complaints. Higher scores correlate with a higher specificity for IBS.
Usage
manning_ibs_criteria(pain_relieved_by_defecation, incomplete_bowel_movement,
mucus_in_stool, change_in_stool_consistency,
more_frequent_stool_with_pain, abdominal_distension)
Arguments
pain_relieved_by_defecation |
Numeric (0 or 1). Abdominal pain relieved by defecation. (1 = Yes). |
incomplete_bowel_movement |
Numeric (0 or 1). Feeling of incomplete bowel movements. (1 = Yes). |
mucus_in_stool |
Numeric (0 or 1). Passage of mucus per rectum. (1 = Yes). |
change_in_stool_consistency |
Numeric (0 or 1). Change in stool consistency (looser stools) with onset of pain. (1 = Yes). |
more_frequent_stool_with_pain |
Numeric (0 or 1). More frequent bowel movements with onset of pain. (1 = Yes). |
abdominal_distension |
Numeric (0 or 1). Visible abdominal distension. (1 = Yes). |
Value
A list containing:
Manning_Score |
The total count of positive criteria (Range 0-6). |
Interpretation |
Diagnostic likelihood based on the number of criteria met. |
References
Manning AP, Thompson WG, Heaton KW, Morris AF. Towards positive diagnosis of the irritable bowel. Br Med J. 1978;2(6138):653-654. doi:10.1136/bmj.2.6138.653
Examples
# Example 1: High Likelihood
# Pain relief(1), Incomplete(1), Distension(1), Consistency(1)
# Score = 4
manning_ibs_criteria(1, 1, 0, 1, 0, 1)
# Example 2: Low Likelihood
# Distension only
# Score = 1
manning_ibs_criteria(0, 0, 0, 0, 0, 1)
Mayo Alliance Prognostic System (MAPS) for Systemic Mastocytosis
Description
Calculates the MAPS Score (Hybrid Clinical-Molecular Model) to predict overall survival in patients with Systemic Mastocytosis (SM). The score integrates clinical subtypes, age, laboratory findings, and high-risk mutations.
Usage
maps_systemic_mastocytosis_score(sm_category, age, platelet_count,
alp_elevated, adverse_mutations)
Arguments
sm_category |
String. Systemic Mastocytosis subtype. "indolent": Indolent SM or Smoldering SM (0 points). "advanced": Aggressive SM, Mast Cell Leukemia, or SM with Associated Hematologic Neoplasm (+2 points). |
age |
Numeric. Patient age in years. (> 60 years adds +1 point). |
platelet_count |
Numeric. Platelet count in x10^9/L. (< 150 x 10^9/L adds +1 point). |
alp_elevated |
Numeric (0 or 1). Serum Alkaline Phosphatase (ALP) above the upper limit of normal. (1 = Yes, +1 point). |
adverse_mutations |
Numeric (0 or 1). Presence of adverse mutations (ASXL1, RUNX1, or NRAS). (1 = Yes, +1 point). |
Value
A list containing:
MAPS_Score |
The calculated prognostic score (Range 0-6). |
Risk_Category |
Classification (Low: 0, Intermediate: 1-2, High: >=3). |
References
Pardanani A, Lasho T, Elala Y, et al. Mayo alliance prognostic system for mastocytosis: clinical and hybrid clinical-molecular models. Blood Adv. 2018;2(21):2964-2972. doi:10.1182/bloodadvances.2018026229
Examples
# Example 1: High Risk
# Advanced SM (+2), Age 65 (+1), Plt 100 (+1), ALP High (+1), No Mutations
# Score = 5
maps_systemic_mastocytosis_score("advanced", 65, 100, 1, 0)
# Example 2: Low Risk
# Indolent SM (0), Age 40 (0), Plt 250 (0), ALP Normal (0), No Mutations
# Score = 0
maps_systemic_mastocytosis_score("indolent", 40, 250, 0, 0)
Marburg Heart Score (MHS)
Description
Calculates the Marburg Heart Score to rule out coronary artery disease (CAD) in primary care patients presenting with chest pain. The score stratifies patients into low, intermediate, or high probability of having significant CAD based on five clinical predictors.
Usage
marburg_heart_score(age, sex, history_vascular_disease, patient_suspects_cardiac,
pain_worsens_exercise, pain_not_reproducible)
Arguments
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). (Score adds 1 point if Male >= 55 or Female >= 65). |
history_vascular_disease |
Numeric (0 or 1). Known atherosclerosis, including Coronary Artery Disease, Cerebrovascular Disease, or Peripheral Arterial Disease. (1 = Yes, +1 point). |
patient_suspects_cardiac |
Numeric (0 or 1). Does the patient assume the pain is of cardiac origin? (1 = Yes, +1 point). |
pain_worsens_exercise |
Numeric (0 or 1). Does the pain worsen with exercise? (1 = Yes, +1 point). |
pain_not_reproducible |
Numeric (0 or 1). Is the pain NOT reproducible by palpation? (1 = Yes/Not Reproducible, +1 point. Note: If pain IS reproducible, enter 0). |
Value
A list containing:
MHS_Score |
The calculated score (Range 0-5). |
Risk_Category |
Classification (Low 0-2, Intermediate 3, High 4-5). |
CAD_Probability |
Estimated probability of significant Coronary Artery Disease. |
References
Bosner S, Becker A, Haasenritter J, et al. Chest pain in primary care: epidemiology and pre-work-up probabilities. Eur J Gen Pract. 2009;15(3):141-146. Haasenritter J, Bösner S, Vaucher P, et al. Ruling out coronary heart disease in primary care: external validation of a clinical prediction rule. CMAJ. 2012;184(3):E149-E157. doi:10.1503/cmaj.110960
Examples
# Example 1: High Risk
# 60yo Male (+1), Vascular Hx (+1), Suspects Cardiac (+1), Exertional (+1), Not Reproducible (+1)
# Score = 5
marburg_heart_score(60, "male", 1, 1, 1, 1)
# Example 2: Low Risk
# 40yo Female (0), No Hx, Reproducible pain (Input 0 for 'not reproducible')
# Score = 0
marburg_heart_score(40, "female", 0, 0, 0, 0)
MASCC Risk Index for Febrile Neutropenia
Description
Calculates the Multinational Association for Supportive Care in Cancer (MASCC) Risk Index to identify low-risk patients with febrile neutropenia. A score >= 21 indicates a low risk of complications, suggesting that the patient may be eligible for outpatient management and/or oral antibiotics.
Usage
mascc_risk_index(burden_severity, hypotension_present, copd_history, tumor_type,
previous_fungal_infection, dehydration_present, outpatient_status,
age)
Arguments
burden_severity |
String. Burden of febrile neutropenia illness. Options: "none_mild" (+5 pts), "moderate" (+3 pts), "severe" (0 pts). |
hypotension_present |
Numeric (0 or 1). Presence of hypotension (Systolic BP < 90 mmHg). (1 = Yes, 0 pts; 0 = No, +5 pts). |
copd_history |
Numeric (0 or 1). History of Chronic Obstructive Pulmonary Disease. (1 = Yes, 0 pts; 0 = No, +4 pts). |
tumor_type |
String. Type of malignancy. "solid" or "hematologic". |
previous_fungal_infection |
Numeric (0 or 1). Previous fungal infection (only relevant for hematologic malignancy). (1 = Yes). Note: Solid tumor OR (Hematologic malignancy with NO previous fungal infection) adds +4 pts. |
dehydration_present |
Numeric (0 or 1). Dehydration requiring parenteral fluids. (1 = Yes, 0 pts; 0 = No, +3 pts). |
outpatient_status |
Numeric (0 or 1). Patient status at onset of fever. (1 = Outpatient, +3 pts; 0 = Inpatient, 0 pts). |
age |
Numeric. Patient age in years. (< 60 years adds +2 pts). |
Value
A list containing:
MASCC_Score |
The calculated total score (Range 0-26). |
Risk_Category |
"Low Risk" (>= 21) or "High Risk" (< 21). |
Recommendation |
Clinical guidance regarding disposition and therapy. |
References
Klastersky J, Paesmans M, Rubenstein EB, et al. The Multinational Association for Supportive Care in Cancer risk index: A multinational scoring system for identifying low-risk febrile neutropenic cancer patients. J Clin Oncol. 2000;18(16):3038-3051. doi:10.1200/JCO.2000.18.16.3038
Examples
# Example 1: Low Risk
# Mild symptoms, No hypotension, No COPD, Solid tumor, No dehydration, Outpatient, Age 45
# Score = 5 + 5 + 4 + 4 + 3 + 3 + 2 = 26
mascc_risk_index("none_mild", 0, 0, "solid", 0, 0, 1, 45)
# Example 2: High Risk
# Severe symptoms, Hypotension, Heme malignancy with fungal hx, Inpatient, Age 70
# Score = 0 + 0 + 4 + 0 + 3 + 0 + 0 = 7
mascc_risk_index("severe", 1, 0, "hematologic", 1, 0, 0, 70)
Maximum Allowable Blood Loss (ABL) without Transfusion
Description
Calculates the Maximum Allowable Blood Loss (ABL) for a patient before a red blood cell transfusion is theoretically required. The calculation estimates the patient's total blood volume (EBV) based on weight and age/sex, then uses the Bourke and Smith formula involving the initial and target hematocrit levels.
Usage
maximum_allowable_blood_loss(weight_kg, initial_hct, target_hct, patient_type)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. |
initial_hct |
Numeric. The patient's starting hematocrit percentage (e.g., 45). |
target_hct |
Numeric. The minimum acceptable hematocrit percentage (e.g., 30). |
patient_type |
String. The category of the patient used to estimate blood volume (mL/kg). Options: "premature" (95 mL/kg) "neonate" (85 mL/kg) "infant" (80 mL/kg) "child" (75 mL/kg) "adult_male" (75 mL/kg) "adult_female" (65 mL/kg) |
Value
A list containing:
Allowable_Blood_Loss_mL |
The estimated volume of blood loss permitted to reach the target hematocrit. |
Estimated_Blood_Volume_mL |
The total estimated blood volume of the patient. |
References
Bourke DL, Smith TC. Estimating allowable hemodilution. Anesthesiology. 1974;41(6):609-612. doi:10.1097/00000542-197412000-00013
Examples
# Example 1: Adult Male
# 80kg, Starting Hct 45, Target 30
# EBV = 80 * 75 = 6000 mL
# ABL = 6000 * (45-30) / ((45+30)/2) = 6000 * 15 / 37.5 = 2400 mL
maximum_allowable_blood_loss(80, 45, 30, "adult_male")
# Example 2: Infant
# 8kg, Starting Hct 38, Target 28
# EBV = 8 * 80 = 640 mL
# ABL = 640 * (38-28) / ((38+28)/2) = 640 * 10 / 33 = 194 mL
maximum_allowable_blood_loss(8, 38, 28, "infant")
Mayo Clinic Model for Solitary Pulmonary Nodule Malignancy Risk
Description
Calculates the probability of malignancy in a solitary pulmonary nodule (SPN) based on the Mayo Clinic model. The model uses six independent predictors: age, smoking history, extrathoracic cancer history (>5 years prior), nodule diameter, upper lobe location, and spiculation.
Usage
mayo_spn_risk(age, smoking_history, cancer_history_gt_5y, nodule_diameter_mm,
upper_lobe, spiculation)
Arguments
age |
Numeric. Patient age in years. |
smoking_history |
Numeric (0 or 1). Current or former smoker. (1 = Yes). |
cancer_history_gt_5y |
Numeric (0 or 1). History of extrathoracic cancer diagnosed more than 5 years ago. (1 = Yes). |
nodule_diameter_mm |
Numeric. Diameter of the nodule in millimeters. |
upper_lobe |
Numeric (0 or 1). Is the nodule located in an upper lobe? (1 = Yes). |
spiculation |
Numeric (0 or 1). Does the nodule have spiculation on imaging? (1 = Yes). |
Value
A list containing:
Mayo_Malignancy_Risk_Percent |
The estimated percentage probability that the nodule is malignant. |
Risk_Category |
Classification of risk (Low <5%, Intermediate 5-65%, High >65%). |
References
Swensen SJ, Silverstein MD, Ilstrup DM, Schleck CD, Edell ES. The probability of malignancy in solitary pulmonary nodules. Application to small radiologically indeterminate nodules. Arch Intern Med. 1997;157(8):849-855.
Examples
# Example 1: High Risk
# 70yo, Smoker, Hx Cancer, 20mm, Upper Lobe, Spiculated
# Log-odds = -6.8272 + 2.737 + 0.7917 + 1.3388 + 2.548 + 0.7838 + 1.0407 = 2.41
# Prob = e^2.41 / (1 + e^2.41) = ~91%
mayo_spn_risk(70, 1, 1, 20, 1, 1)
# Example 2: Low Risk
# 40yo, Non-smoker, No Hx, 5mm, Lower Lobe, Smooth
# Log-odds = -6.8272 + 1.564 + 0 + 0 + 0.637 + 0 + 0 = -4.62
# Prob = ~1%
mayo_spn_risk(40, 0, 0, 5, 0, 0)
Mayo Score / Disease Activity Index (DAI) for Ulcerative Colitis
Description
Calculates the Mayo Score (also known as the Disease Activity Index) for Ulcerative Colitis. This tool assesses disease severity based on four criteria: stool frequency, rectal bleeding, endoscopic findings, and the physician's global assessment.
Usage
mayo_uc_score(stool_frequency, rectal_bleeding, endoscopic_findings,
physician_global_assessment)
Arguments
stool_frequency |
Numeric (0-3). Stool frequency relative to normal. 0: Normal number of stools. 1: 1-2 stools more than normal. 2: 3-4 stools more than normal. 3: 5 or more stools more than normal. |
rectal_bleeding |
Numeric (0-3). Rectal bleeding. 0: No blood seen. 1: Streaks of blood with stool less than half the time. 2: Obvious blood with stool most of the time. 3: Blood alone passes. |
endoscopic_findings |
Numeric (0-3). Findings on endoscopy (flexible proctosigmoidoscopy). 0: Normal or inactive disease. 1: Mild disease (erythema, decreased vascular pattern, mild friability). 2: Moderate disease (marked erythema, lack of vascular pattern, friability, erosions). 3: Severe disease (spontaneous bleeding, ulceration). |
physician_global_assessment |
Numeric (0-3). Physician's Global Assessment. 0: Normal. 1: Mild disease. 2: Moderate disease. 3: Severe disease. |
Value
A list containing:
Mayo_Score |
The calculated total score (Range 0-12). |
Disease_Activity |
Interpretation of disease severity (Remission, Mild, Moderate, Severe). |
References
Schroeder KW, Tremaine WJ, Ilstrup DM. Coated oral 5-aminosalicylic acid therapy for mildly to moderately active ulcerative colitis. N Engl J Med. 1987;317(26):1625-1629. doi:10.1056/NEJM198712243172603
Examples
# Example 1: Moderate Activity
# Freq +1 (1), Bleeding +1 (1), Endo Moderate (2), PGA Moderate (2)
# Score = 6
mayo_uc_score(1, 1, 2, 2)
# Example 2: Severe Activity
# Freq +3 (3), Blood alone (3), Endo Severe (3), PGA Severe (3)
# Score = 12
mayo_uc_score(3, 3, 3, 3)
Modified Brain Injury Guidelines (mBIG) for TBI
Description
Classifies patients with Traumatic Brain Injury (TBI) and intracranial hemorrhage into three risk categories (mBIG 1, 2, or 3) to guide resource utilization, including the need for neurosurgical consultation, repeat imaging, and hospitalization. This modified version (Khan et al., 2020) updates the original BIG criteria for improved safety and reproducibility.
Usage
mbig_score(gcs, focal_neuro_deficit, anti_coagulation, intoxication,
skull_fracture_type, epidural_hematoma, subdural_hematoma_mm,
intraparenchymal_hemorrhage_mm, subarachnoid_hemorrhage_type,
intraventricular_hemorrhage)
Arguments
gcs |
Numeric. Glasgow Coma Scale score (3-15). |
focal_neuro_deficit |
Numeric (0 or 1). Presence of focal neurological findings or pupillary asymmetry. (1 = Yes). |
anti_coagulation |
Numeric (0 or 1). Use of anticoagulants or antiplatelets (excluding aspirin 81mg in some protocols, but often any agents). (1 = Yes). |
intoxication |
Numeric (0 or 1). Alcohol or drug intoxication present (e.g., EtOH > 80 mg/dL). (1 = Yes). |
skull_fracture_type |
String. "none", "non_displaced", or "displaced". |
epidural_hematoma |
Numeric (0 or 1). Presence of Epidural Hematoma (EDH). (1 = Yes). Note: Any EDH places patient in mBIG 3. |
subdural_hematoma_mm |
Numeric. Size of Subdural Hematoma (SDH) in millimeters. (<4mm: mBIG 1, 4-7.9mm: mBIG 2, >=8mm: mBIG 3). |
intraparenchymal_hemorrhage_mm |
Numeric. Size of Intraparenchymal Hemorrhage (IPH) in millimeters. (<4mm: mBIG 1, 4-7.9mm: mBIG 2, >=8mm: mBIG 3). |
subarachnoid_hemorrhage_type |
String. Extent of Subarachnoid Hemorrhage (SAH). "none": No SAH. "trace": <= 3 sulci and < 1 mm. "localized": 1 hemisphere or 1-3 mm. "extensive": Bi-hemispheric or > 3 mm. |
intraventricular_hemorrhage |
Numeric (0 or 1). Presence of Intraventricular Hemorrhage (IVH). (1 = Yes). |
Value
A list containing:
mBIG_Category |
The assigned risk category (mBIG 1, 2, or 3). |
Management_Plan |
Recommendations for admission, imaging, and consultation. |
References
Khan AD, Elseth AJ, Brosius JA, et al. Multicenter assessment of the Brain Injury Guidelines and a proposal of guideline modifications. Trauma Surg Acute Care Open. 2020;5(1):e000483. doi:10.1136/tsaco-2020-000483
Examples
# Example 1: Low Risk (mBIG 1)
# GCS 15, Small SDH (3mm), No other findings
mbig_score(15, 0, 0, 0, "none", 0, 3, 0, "none", 0)
# Example 2: Moderate Risk (mBIG 2)
# GCS 15, Non-displaced fracture, 5mm IPH
mbig_score(15, 0, 0, 0, "non_displaced", 0, 0, 5, "none", 0)
# Example 3: High Risk (mBIG 3)
# GCS 15, On Warfarin (Anti-coag)
mbig_score(15, 0, 1, 0, "none", 0, 0, 0, "none", 0)
McDonald Criteria for Multiple Sclerosis (2017 Revision)
Description
Evaluates the 2017 Revised McDonald Criteria for the diagnosis of Multiple Sclerosis (MS). Diagnosis relies on demonstrating Dissemination in Space (DIS) and Dissemination in Time (DIT). A key update in the 2017 revision is that the presence of CSF-specific oligoclonal bands can substitute for the requirement of DIT in patients with a typical clinically isolated syndrome (CIS).
Usage
mcdonald_ms_criteria(clinical_attacks, clinical_lesions, dis_demonstrated,
dit_demonstrated, csf_oligoclonal_bands)
Arguments
clinical_attacks |
Numeric. Number of clinical attacks (relapses). (1 or >=2). |
clinical_lesions |
Numeric. Number of lesions with objective clinical evidence. (1 or >=2). |
dis_demonstrated |
Numeric (0 or 1). Dissemination in Space (DIS) demonstrated by MRI (>=1 T2 lesion in >=2 MS-typical regions: periventricular, cortical/juxtacortical, infratentorial, spinal cord). (1 = Yes). |
dit_demonstrated |
Numeric (0 or 1). Dissemination in Time (DIT) demonstrated by MRI (simultaneous presence of gadolinium-enhancing and non-enhancing lesions, or a new T2/enhancing lesion on follow-up). (1 = Yes). |
csf_oligoclonal_bands |
Numeric (0 or 1). Presence of CSF-specific oligoclonal bands. (1 = Yes). Note: Can substitute for DIT in the 2017 criteria for CIS. |
Value
A list containing:
Diagnosis |
"Multiple Sclerosis (MS)" or "Possible MS / Clinically Isolated Syndrome (CIS)". |
Missing_Requirements |
List of criteria still needed to confirm the diagnosis. |
References
Thompson AJ, Banwell BL, Barkhof F, et al. Diagnosis of multiple sclerosis: 2017 revisions of the McDonald criteria. Lancet Neurol. 2018;17(2):162-173. doi:10.1016/S1474-4422(17)30470-2
Examples
# Example 1: 2 attacks, 1 clinical lesion, DIS on MRI
# Result: MS Diagnosed
mcdonald_ms_criteria(2, 1, 1, 0, 0)
# Example 2: CIS (1 attack, 1 lesion), DIS on MRI, No DIT on MRI, but CSF Positive
# Result: MS Diagnosed (CSF substitutes for DIT)
mcdonald_ms_criteria(1, 1, 1, 0, 1)
# Example 3: CIS (1 attack, 2 lesions), No DIT, No CSF
# Result: Possible MS (Missing DIT/CSF)
mcdonald_ms_criteria(1, 2, 0, 0, 0)
McDonald Criteria for Multiple Sclerosis (2010 Revision)
Description
Evaluates the 2010 Revised McDonald Criteria for the diagnosis of Multiple Sclerosis (MS). These criteria allow for the diagnosis of MS in patients with a first clinical demyelinating event (Clinically Isolated Syndrome) using MRI evidence to substitute for clinical dissemination in space (DIS) and/or time (DIT).
Usage
mcdonald_ms_criteria_2010(clinical_attacks, clinical_lesions, dis_demonstrated,
dit_demonstrated)
Arguments
clinical_attacks |
Numeric. Number of clinical attacks (relapses). (1 or >=2). |
clinical_lesions |
Numeric. Number of lesions with objective clinical evidence. (1 or >=2). |
dis_demonstrated |
Numeric (0 or 1). Dissemination in Space (DIS) demonstrated by MRI (>=1 T2 lesion in >=2 of 4 MS-typical regions: periventricular, juxtacortical, infratentorial, or spinal cord). (1 = Yes). |
dit_demonstrated |
Numeric (0 or 1). Dissemination in Time (DIT) demonstrated by MRI (e.g., simultaneous asymptomatic gadolinium-enhancing and non-enhancing lesions, or a new T2/enhancing lesion on follow-up). (1 = Yes). |
Value
A list containing:
Diagnosis |
"Multiple Sclerosis (MS)" or "Criteria Not Met / Possible CIS". |
Missing_Criteria |
List of specific criteria (DIS or DIT) required to confirm the diagnosis. |
References
Polman CH, Reingold SC, Banwell B, et al. Diagnostic criteria for multiple sclerosis: 2010 revisions to the McDonald criteria. Ann Neurol. 2011;69(2):292-302. doi:10.1002/ana.22366
Examples
# Example 1: Diagnosis Met (2 attacks, 1 lesion, DIS present)
mcdonald_ms_criteria_2010(2, 1, 1, 0)
# Example 2: CIS (1 attack, 1 lesion, DIS present, No DIT)
mcdonald_ms_criteria_2010(1, 1, 1, 0)
McMahon Score for Rhabdomyolysis Risk
Description
Calculates the McMahon Score to predict the risk of renal failure (requiring renal replacement therapy) or in-hospital mortality in patients with rhabdomyolysis. A score of 5 or greater indicates a significantly higher risk and may warrant more aggressive fluid resuscitation or monitoring.
Usage
mcmahon_rhabdo_score(age, sex, etiology_high_risk, cpk, bicarbonate, creatinine,
calcium, phosphate, creatinine_units = "mg/dL",
calcium_units = "mg/dL", phosphate_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. <50: 0 pts. 50-70: 1.5 pts. 71-80: 3 pts. >80: 4.5 pts. |
sex |
String. Patient sex ("Male" or "Female"). Female sex adds 1 point. |
etiology_high_risk |
Numeric (0 or 1). Is the etiology "Other" (e.g., trauma, compartment syndrome, ischemia, sepsis, surgery)? (1 = Yes, +3 pts). Note: Select 0 for seizures, syncope, exercise, drug toxicity, statins, or myositis. |
cpk |
Numeric. Initial CPK (Creatine Phosphokinase) level in U/L. (>40,000 adds 2 pts). |
bicarbonate |
Numeric. Initial serum bicarbonate in mEq/L or mmol/L. (<19 adds 2 pts). |
creatinine |
Numeric. Initial serum creatinine. <1.4 mg/dL: 0 pts. 1.4-2.2 mg/dL: 1.5 pts. 2.3-4.5 mg/dL: 3 pts. >4.5 mg/dL: 4.5 pts. |
calcium |
Numeric. Initial serum calcium. (<7.5 mg/dL adds 2 pts). |
phosphate |
Numeric. Initial serum phosphate. <4.0 mg/dL: 0 pts. 4.0-5.4 mg/dL: 1.5 pts. >=5.5 mg/dL: 3 pts. |
creatinine_units |
String. Units for creatinine. "mg/dL" (default) or "umol/L". |
calcium_units |
String. Units for calcium. "mg/dL" (default) or "mmol/L". |
phosphate_units |
String. Units for phosphate. "mg/dL" (default) or "mmol/L". |
Value
A list containing:
McMahon_Score |
The calculated risk score (Range 0-10+). |
Risk_Category |
Classification (Low Risk vs. High Risk). |
Risk_Renal_Failure_or_Death |
Estimated percentage risk. |
References
McMahon GM, Zeng X, Waikar SS. A risk prediction score for kidney failure or mortality in rhabdomyolysis. JAMA Intern Med. 2013;173(19):1821-1828. doi:10.1001/jamainternmed.2013.9774
Examples
# Example 1: Low Risk
# Male, 30yo, Exercise induced, CPK 20k, normal labs
mcmahon_rhabdo_score(30, "male", 0, 20000, 24, 0.9, 9.0, 3.5)
# Example 2: High Risk
# Female, 75yo (+3 +1), Trauma (+3), CPK 50k (+2), Acidosis (+2), Cr 2.0 (+1.5)
# Score = 12.5
mcmahon_rhabdo_score(75, "female", 1, 50000, 18, 2.0, 8.0, 3.5)
MDRD GFR Equation (IDMS-Traceable)
Description
Calculates the estimated Glomerular Filtration Rate (eGFR) using the Modification of Diet in Renal Disease (MDRD) Study equation. This version uses the IDMS-traceable formula (standardized serum creatinine). Note: The MDRD equation has largely been superseded by CKD-EPI for general use but remains relevant in certain clinical contexts or historical data comparisons.
Usage
mdrd_gfr_equation(creatinine, age, sex, race, creatinine_units = "mg/dL")
Arguments
creatinine |
Numeric. Serum Creatinine level. |
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). |
race |
String. Patient race ("black" or "other"). The equation applies a correction factor (x1.212) for African American patients. |
creatinine_units |
String. Units for creatinine input. Options: "mg/dL" (default) or "umol/L" (or "micromol/L"). |
Value
A list containing:
MDRD_GFR |
The estimated GFR in mL/min/1.73m^2. |
CKD_Stage |
Staging classification based on the calculated GFR. |
References
Levey AS, Coresh J, Greene T, et al. Using standardized serum creatinine values in the modification of diet in renal disease study equation for estimating glomerular filtration rate. Ann Intern Med. 2006;145(4):247-254. doi:10.7326/0003-4819-145-4-200608150-00004
Examples
# Example 1: Healthy Adult
# Cr 0.9, 40yo Male, Non-Black
# GFR = 175 * (0.9)^-1.154 * (40)^-0.203 = ~98
mdrd_gfr_equation(0.9, 40, "male", "other")
# Example 2: Chronic Kidney Disease
# Cr 2.5, 65yo Female, Black
# GFR = 175 * (2.5)^-1.154 * (65)^-0.203 * 0.742 * 1.212 = ~23
mdrd_gfr_equation(2.5, 65, "female", "black")
Mehran Score for Post-PCI Contrast-Induced Nephropathy (CIN)
Description
Calculates the Mehran Risk Score to predict the risk of Contrast-Induced Nephropathy (CIN) and the need for dialysis following Percutaneous Coronary Intervention (PCI). The score uses clinical factors (hypotension, IABP, CHF, age, diabetes, anemia), contrast volume, and renal function (Serum Creatinine or eGFR).
Usage
mehran_score_cin(hypotension, intraaortic_balloon_pump, congestive_heart_failure,
age_gt_75, diabetes, anemia, contrast_volume_cc,
serum_creatinine_mg_dl = NULL, egfr_ml_min = NULL)
Arguments
hypotension |
Numeric (0 or 1). SBP < 80 mmHg for > 1 hour requiring inotropes or IABP support. (1 = Yes, +5 pts). |
intraaortic_balloon_pump |
Numeric (0 or 1). Use of IABP. (1 = Yes, +5 pts). |
congestive_heart_failure |
Numeric (0 or 1). CHF Class III/IV or history of pulmonary edema. (1 = Yes, +5 pts). |
age_gt_75 |
Numeric (0 or 1). Age > 75 years. (1 = Yes, +4 pts). |
diabetes |
Numeric (0 or 1). History of diabetes. (1 = Yes, +3 pts). |
anemia |
Numeric (0 or 1). Baseline hematocrit < 39% for men or < 36% for women. (1 = Yes, +3 pts). |
contrast_volume_cc |
Numeric. Total volume of contrast media used in cc (mL). (1 point per 100 cc). |
serum_creatinine_mg_dl |
Numeric (Optional). Baseline Serum Creatinine in mg/dL. (> 1.5 mg/dL adds 4 pts). Note: Original score used SCr; updated versions often incorporate eGFR. |
egfr_ml_min |
Numeric (Optional). Estimated GFR in mL/min/1.73m^2. Used if Serum Creatinine is not provided for more granular scoring (20-40: +4, 40-60: +2, <20: +6). |
Value
A list containing:
Mehran_Score |
The calculated risk score (Range 0-~30+). |
Risk_Class |
Classification (Low, Moderate, High, Very High). |
Risk_CIN |
Estimated probability of developing CIN (>= 25% rise or >= 0.5 mg/dL increase in SCr). |
Risk_Dialysis |
Estimated probability of requiring dialysis. |
References
Mehran R, Aymong ED, Nikolsky E, et al. A simple risk score for prediction of contrast-induced nephropathy after percutaneous coronary intervention: development and initial validation. J Am Coll Cardiol. 2004;44(7):1393-1399. doi:10.1016/j.jacc.2004.06.068
Examples
# Example 1: High Risk
# Hypotension (+5), Diabetes (+3), Contrast 250cc (+2), SCr 1.8 (+4)
# Score = 14
mehran_score_cin(1, 0, 0, 0, 1, 0, 250, serum_creatinine_mg_dl = 1.8)
# Example 2: Low Risk
# Age 50 (0), Contrast 100cc (+1), Normal SCr (0), No other factors
# Score = 1
mehran_score_cin(0, 0, 0, 0, 0, 0, 100, serum_creatinine_mg_dl = 0.9)
Mekhail Extension of the Motzer Score for Metastatic RCC
Description
Calculates the Mekhail Extension of the Motzer Score (MSKCC Score) for prognosis in patients with metastatic Renal Cell Carcinoma (mRCC) who have received prior immunotherapy or chemotherapy. This model adds "Metastasis in >= 2 organs" to the original 5 Motzer risk factors.
Usage
mekhail_motzer_score(time_to_treatment_lt_1y, kps_lt_80, hemoglobin_low,
calcium_high, ldh_high, metastasis_sites_ge_2)
Arguments
time_to_treatment_lt_1y |
Numeric (0 or 1). Time from initial diagnosis to start of systemic treatment < 1 year. (1 = Yes). |
kps_lt_80 |
Numeric (0 or 1). Karnofsky Performance Status < 80%. (1 = Yes). |
hemoglobin_low |
Numeric (0 or 1). Serum hemoglobin less than the lower limit of normal. (1 = Yes). |
calcium_high |
Numeric (0 or 1). Corrected serum calcium > 10 mg/dL (2.5 mmol/L). (1 = Yes). |
ldh_high |
Numeric (0 or 1). Lactate Dehydrogenase > 1.5x Upper Limit of Normal. (1 = Yes). |
metastasis_sites_ge_2 |
Numeric (0 or 1). Metastasis in 2 or more organs. (1 = Yes). |
Value
A list containing:
Mekhail_Score |
The total count of risk factors present (Range 0-6). |
Risk_Group |
Classification (Favorable: 0, Intermediate: 1-2, Poor: >=3). |
Median_Overall_Survival |
Estimated median survival time based on the validation cohort. |
References
Mekhail TM, Abou-Jawde RM, Boumerhi G, et al. Validation and extension of the Memorial Sloan-Kettering prognostic factors model for survival in patients with previously treated metastatic renal cell carcinoma. J Clin Oncol. 2005;23(4):832-841. doi:10.1200/JCO.2005.05.179
Examples
# Example 1: Poor Risk
# KPS 70 (1), Anemia (1), 3 Metastatic Sites (1)
# Score = 3
mekhail_motzer_score(0, 1, 1, 0, 0, 1)
# Example 2: Favorable Risk
# No risk factors
# Score = 0
mekhail_motzer_score(0, 0, 0, 0, 0, 0)
MELD-Na Score for Liver Cirrhosis
Description
Calculates the MELD-Na (Model for End-Stage Liver Disease including Sodium) score. This version, adopted by OPTN/UNOS in 2016, incorporates serum sodium to better predict 3-month mortality in patients with end-stage liver disease, particularly those with hyponatremia.
Usage
meld_na_score_liver(bilirubin, inr, creatinine, sodium, on_dialysis = 0,
bilirubin_units = "mg/dL", creatinine_units = "mg/dL")
Arguments
bilirubin |
Numeric. Total Bilirubin level. |
inr |
Numeric. International Normalized Ratio. |
creatinine |
Numeric. Serum Creatinine level. |
sodium |
Numeric. Serum Sodium level (mEq/L). |
on_dialysis |
Numeric (0 or 1). Has the patient had dialysis at least twice in the past week? (1 = Yes). If Yes, creatinine is set to 4.0 mg/dL. |
bilirubin_units |
String. Units for bilirubin input. "mg/dL" (default) or "umol/L". |
creatinine_units |
String. Units for creatinine input. "mg/dL" (default) or "umol/L". |
Value
A list containing:
MELD_Na_Score |
The calculated MELD-Na score (Range 6-40). |
Est_3_Month_Mortality |
Estimated 3-month mortality percentage. |
References
Kim WR, Biggins SW, Kremers WK, et al. Hyponatremia and mortality among patients on the liver-transplant waiting list. N Engl J Med. 2008;359(10):1018-1026. doi:10.1056/NEJMoa0801209 OPTN/UNOS Policy Notice. Liver Policy: MELD Score / MELD-Na Score. 2016.
Examples
# Example 1: High Risk (Hyponatremia Effect)
# Bili 2.0, INR 1.5, Cr 1.5, Na 125 (Low Na increases score)
meld_na_score_liver(2.0, 1.5, 1.5, 125, 0)
# Example 2: Standard Risk
# Bili 1.0, INR 1.0, Cr 1.0, Na 138 (Na capped at 137)
# Score = 6
meld_na_score_liver(1.0, 1.0, 1.0, 138, 0)
Model for End-Stage Liver Disease (MELD) Score (Original, Pre-2016)
Description
Calculates the original MELD score used to assess the severity of end-stage liver disease and predict 3-month mortality. This version uses Creatinine, Bilirubin, and INR. Note: The United Network for Organ Sharing (UNOS) updated their policy in 2016 to use the MELD-Na score for transplant prioritization.
Usage
meld_score_original(bilirubin, inr, creatinine, on_dialysis = 0,
bilirubin_units = "mg/dL", creatinine_units = "mg/dL")
Arguments
bilirubin |
Numeric. Total Bilirubin level. |
inr |
Numeric. International Normalized Ratio. |
creatinine |
Numeric. Serum Creatinine level. |
on_dialysis |
Numeric (0 or 1). Has the patient had dialysis at least twice in the past week? (1 = Yes). If Yes, creatinine is capped at 4.0 mg/dL. |
bilirubin_units |
String. Units for bilirubin input. Options: "mg/dL" (default) or "umol/L". |
creatinine_units |
String. Units for creatinine input. Options: "mg/dL" (default) or "umol/L". |
Details
The formula is:
MELD = 10 \times (0.957 \times \ln(Creatinine) + 0.378 \times \ln(Bilirubin) + 1.120 \times \ln(INR) + 0.643)
Any value less than 1.0 is set to 1.0. Creatinine is capped at 4.0 mg/dL.
Value
A list containing:
MELD_Score |
The calculated score (Range 6-40). |
Est_3_Month_Mortality |
Estimated 3-month mortality percentage. |
References
Kamath PS, Wiesner RH, Malinchoc M, et al. A model to predict survival in patients with end-stage liver disease. Hepatology. 2001;33(2):464-470. doi:10.1053/jhep.2001.22172
Examples
# Example 1: Low Risk
# Bili 1.0, INR 1.0, Cr 1.0
# Score = 6
meld_score_original(1.0, 1.0, 1.0)
# Example 2: High Risk
# Bili 5.0, INR 2.0, Cr 2.5
# Score = 26
meld_score_original(5.0, 2.0, 2.5)
MELD Score (Original, Pre-2016)
Description
Calculates the original Model for End-Stage Liver Disease (MELD) score. This version does not incorporate serum sodium (MELD-Na). It uses serum bilirubin, serum creatinine, and INR to predict 3-month mortality in patients with end-stage liver disease.
Usage
meld_score_pre_2016(bilirubin, inr, creatinine, on_dialysis = 0,
bilirubin_units = "mg/dL", creatinine_units = "mg/dL")
Arguments
bilirubin |
Numeric. Total Bilirubin level. |
inr |
Numeric. International Normalized Ratio. |
creatinine |
Numeric. Serum Creatinine level. |
on_dialysis |
Numeric (0 or 1). Has the patient had dialysis at least twice in the past week? (1 = Yes). If Yes, creatinine is automatically set to 4.0 mg/dL. |
bilirubin_units |
String. Units for bilirubin input. "mg/dL" (default) or "umol/L". |
creatinine_units |
String. Units for creatinine input. "mg/dL" (default) or "umol/L". |
Details
The formula is:
MELD = 10 \times (0.957 \times \ln(Creatinine) + 0.378 \times \ln(Bilirubin) + 1.120 \times \ln(INR) + 0.643)
Lower limits: Any laboratory value less than 1.0 is set to 1.0. Upper limits: Creatinine is capped at 4.0 mg/dL. The maximum MELD score is capped at 40.
Value
A list containing:
MELD_Score_Original |
The calculated score (Range 6-40). |
Est_3_Month_Mortality |
Estimated 3-month mortality percentage. |
References
Kamath PS, Wiesner RH, Malinchoc M, et al. A model to predict survival in patients with end-stage liver disease. Hepatology. 2001;33(2):464-470. doi:10.1053/jhep.2001.22172
Examples
# Example 1: Low Risk
# Bili 1.0, INR 1.0, Cr 1.0
# Score = 6
meld_score_pre_2016(1.0, 1.0, 1.0)
# Example 2: High Risk (Dialysis)
# Bili 5.0, INR 2.5, Cr 2.0 (on dialysis -> Cr set to 4.0)
# Score = 10 * (0.957*ln(4) + 0.378*ln(5) + 1.12*ln(2.5) + 0.643) = ~36
meld_score_pre_2016(5.0, 2.5, 2.0, 1)
Calculate MELD-XI (Model for End Stage Liver Disease Excluding INR)
Description
Using serum bilirubin and serum creatinine, calculate the MELD Exclusing INR, which models closely with MELD, as devised by Heuman et al. 2007. Validated for use by Wernly et al. 2017, cutoffs for MELD and MELD-XI appear identical in practice, the former of which used by UNOS for organ transplantation need. More research needs to be done to calculate associated survival or cutoff values.
Usage
meld_xi(sbill, screat)
Arguments
sbill |
Numeric value of serum bilirubin in mg/dL. |
screat |
Numeric value of serum creatinine in mg/dL. |
Value
A numeric value/vector with MELD-XI score (comparable to MELD scores).
References
Heuman, D.M., Mihas, A.A., Habib, A., Gilles, H.S., Stravitz, R.T., Sanyal, A.J. and Fisher, R.A. (2007), MELD-XI: A rational approach to “sickest first” liver transplantation in cirrhotic patients requiring anticoagulant therapy. Liver Transpl, 13: 30-37. https://doi.org/10.1002/lt.20906 Wernly B, Lichtenauer M, Franz M, et al. Model for End-stage Liver Disease excluding INR (MELD-XI) score in critically ill patients: Easily available and of prognostic relevance. PLoS One. 2017;12(2):e0170987. Published 2017 Feb 2. doi:10.1371/journal.pone.0170987
Examples
# The function is defined as
meld_xi(0.6,0.65)
Mentzer Index for Microcytic Anemia
Description
Calculates the Mentzer Index to help differentiate between iron deficiency anemia and beta-thalassemia trait in patients with microcytic anemia. The index is the ratio of Mean Corpuscular Volume (MCV) to Red Blood Cell count (RBC).
Usage
mentzer_index(mcv, rbc_count)
Arguments
mcv |
Numeric. Mean Corpuscular Volume in fL. |
rbc_count |
Numeric. Red Blood Cell count in Millions/uL (x10^12/L). |
Value
A list containing:
Mentzer_Index |
The calculated index value. |
Interpretation |
Diagnostic suggestion (<13 favors Thalassemia, >13 favors Iron Deficiency). |
References
Mentzer WC Jr. Differentiation of iron deficiency from thalassaemia trait. Lancet. 1973;1(7808):882. doi:10.1016/s0140-6736(73)91446-3
Examples
# Example 1: Thalassemia Trait Likely
# MCV 65, RBC 5.5
# Index = 65 / 5.5 = 11.8
mentzer_index(65, 5.5)
# Example 2: Iron Deficiency Likely
# MCV 70, RBC 3.5
# Index = 70 / 3.5 = 20
mentzer_index(70, 3.5)
Menza Score for HIV Risk in MSM
Description
Calculates the Menza Score to predict the 4-year risk of HIV infection in Men who have Sex with Men (MSM). The score identifies high-risk individuals who may benefit from targeted prevention strategies such as Pre-Exposure Prophylaxis (PrEP).
Usage
menza_hiv_risk_score(history_sti, drug_use_meth_poppers,
unprotected_anal_intercourse, partners_gt_10)
Arguments
history_sti |
Numeric (0 or 1). Current or history of gonorrhea, chlamydia, or syphilis. (1 = Yes, +4 points). |
drug_use_meth_poppers |
Numeric (0 or 1). Use of methamphetamine or inhaled nitrites (poppers) in the prior 6 months. (1 = Yes, +11 points). |
unprotected_anal_intercourse |
Numeric (0 or 1). Unprotected anal intercourse with a partner of positive or unknown HIV status in the prior year. (1 = Yes, +1 point). |
partners_gt_10 |
Numeric (0 or 1). Report of 10 or more male sexual partners in the prior year. (1 = Yes, +3 points). |
Value
A list containing:
Menza_Score |
The calculated risk score. |
Risk_Category |
Classification (High Risk >= 1, Low Risk 0). |
Recommendation |
Clinical guidance regarding prevention strategies. |
References
Menza TW, et al. Prediction of HIV acquisition among men who have sex with men. Sex Transm Dis. 2009;36(9):547-555. doi:10.1097/OLQ.0b013e3181a7d10b
Examples
# Example 1: High Risk
# History of STI (+4), no other factors
# Score = 4
menza_hiv_risk_score(1, 0, 0, 0)
# Example 2: Low Risk
# No risk factors present
# Score = 0
menza_hiv_risk_score(0, 0, 0, 0)
Mangled Extremity Severity Score (MESS)
Description
Calculates the Mangled Extremity Severity Score (MESS) to assess the viability of a limb following severe trauma. The score sums points from four categories: Skeletal/Soft-Tissue Injury, Limb Ischemia, Shock, and Age. A score of 7 or higher has been historically associated with a need for amputation, though clinical judgment remains paramount.
Usage
mess_score(skeletal_soft_tissue, limb_ischemia, shock, age,
ischemia_duration_gt_6h = 0)
Arguments
skeletal_soft_tissue |
Numeric (1-4). Energy of injury. 1: Low energy (stab, simple fracture, pistol gunshot). 2: Medium energy (open multifragmentary fracture, dislocation). 3: High energy (high-velocity gunshot, crush). 4: Very high energy (gross contamination, soft tissue avulsion). |
limb_ischemia |
Numeric (0-3). Severity of ischemia. 0: None (Pulse present, perfusion normal). 1: Mild (Pulse reduced/absent, perfusion present). 2: Moderate (Pulseless, paresthesias, diminished capillary refill). 3: Advanced (Pulseless, cool, paralyzed, numb/insensate). |
shock |
Numeric (0-2). Hemodynamic status. 0: Normotensive (SBP always > 90 mmHg). 1: Transient hypotension. 2: Persistent hypotension. |
age |
Numeric (0-2). Patient age group. 0: < 30 years. 1: 30-50 years. 2: > 50 years. |
ischemia_duration_gt_6h |
Numeric (0 or 1). Ischemia duration greater than 6 hours? (1 = Yes). If Yes, the points for the 'limb_ischemia' category are doubled. |
Value
A list containing:
MESS_Score |
The calculated total score (Range 1-14+). |
Interpretation |
Clinical interpretation regarding salvage versus amputation risk (Cutoff >= 7). |
References
Johansen K, Daines M, Howey T, Helfet D, Hansen ST Jr. Objective criteria accurately predict amputation following lower extremity trauma. J Trauma. 1990;30(5):568-572.
Examples
# Example 1: High Risk (Amputation Likely)
# High energy (3), Advanced ischemia (3) > 6h (doubled -> 6), Shock (1), Age 30-50 (1)
# Score = 3 + 6 + 1 + 1 = 11
mess_score(3, 3, 1, 1, 1)
# Example 2: Low Risk (Salvage Likely)
# Medium energy (2), Mild ischemia (1) < 6h (1), No shock (0), Age < 30 (0)
# Score = 2 + 1 + 0 + 0 = 3
mess_score(2, 1, 0, 0, 0)
Metroticket Calculator for HCC Survival (Up-to-7 Criteria)
Description
Calculates the "Up-to-7" score and estimates 5-year overall survival for patients with Hepatocellular Carcinoma (HCC) considered for liver transplantation. This tool identifies patients exceeding the Milan criteria who may still achieve favorable outcomes. The "Up-to-7" criteria are met if the sum of the size of the largest tumor (in cm) and the number of tumors is <= 7, provided there is no microvascular invasion.
Usage
metroticket_hcc_survival(largest_nodule_size_mm, number_of_nodules,
vascular_invasion)
Arguments
largest_nodule_size_mm |
Numeric. Diameter of the largest tumor nodule in millimeters. |
number_of_nodules |
Numeric. Total number of tumor nodules. |
vascular_invasion |
String. Presence of microvascular invasion. Options: "absent", "present", "unknown". |
Value
A list containing:
Up_To_Seven_Score |
The calculated score (Size in cm + Number). |
Predicted_5_Year_Survival |
Estimated survival percentage based on the Mazzaferro et al. (2009) derivation cohort. |
Criteria_Status |
Indicates if the patient meets the "Up-to-7" criteria. |
References
Mazzaferro V, Llovet JM, Miceli R, et al. Predicting survival after liver transplantation in patients with hepatocellular carcinoma beyond the Milan criteria: a retrospective, exploratory analysis. Lancet Oncol. 2009;10(1):35-43. doi:10.1016/S1470-2045(08)70284-5
Examples
# Example 1: Meets Criteria
# 30mm (3cm) tumor, 3 nodules, No invasion
# Score = 3 + 3 = 6 (<= 7)
metroticket_hcc_survival(30, 3, "absent")
# Example 2: Exceeds Criteria
# 50mm (5cm) tumor, 3 nodules, No invasion
# Score = 5 + 3 = 8 (> 7)
metroticket_hcc_survival(50, 3, "absent")
# Example 3: High Risk
# 30mm tumor, 2 nodules, Vascular invasion present
metroticket_hcc_survival(30, 2, "present")
Metabolic Score for Insulin Resistance (METS-IR)
Description
Calculates the METS-IR score, a non-insulin-based index for evaluating insulin sensitivity. It combines fasting plasma glucose, triglycerides, HDL cholesterol, and BMI to estimate insulin resistance. It has been shown to be a useful screening tool for metabolic syndrome and incident type 2 diabetes.
Usage
mets_ir_score(glucose_mg_dl, triglycerides_mg_dl, hdl_mg_dl, bmi)
Arguments
glucose_mg_dl |
Numeric. Fasting plasma glucose in mg/dL. |
triglycerides_mg_dl |
Numeric. Fasting triglycerides in mg/dL. |
hdl_mg_dl |
Numeric. HDL cholesterol in mg/dL. |
bmi |
Numeric. Body Mass Index in kg/m^2. |
Details
The formula used is:
METS-IR = \frac{\ln((2 \times Glucose) + Triglycerides) \times BMI}{\ln(HDL)}
Higher scores generally indicate higher insulin resistance. While cutoffs vary by population, values > 50 are often associated with increased metabolic risk.
Value
A list containing:
METS_IR_Score |
The calculated METS-IR index value. |
References
Bello-Chavolla OY, Almeda-Valdes P, Gomez-Velasco D, et al. METS-IR, a novel score for evaluating insulin sensitivity, is predictive of visceral adiposity and the incident of type 2 diabetes. Eur J Endocrinol. 2018;178(5):533-544. doi:10.1530/EJE-17-0883
Examples
# Example 1: Healthy Profile
# Glucose 85, Trigs 100, HDL 60, BMI 22
# Numerator: ln(170+100)*22 = ln(270)*22 = 5.6*22 = 123.2
# Denominator: ln(60) = 4.09
# Score = 30.1
mets_ir_score(85, 100, 60, 22)
# Example 2: Metabolic Syndrome Profile
# Glucose 110, Trigs 250, HDL 35, BMI 32
# Numerator: ln(220+250)*32 = ln(470)*32 = 6.15*32 = 196.8
# Denominator: ln(35) = 3.56
# Score = 55.3
mets_ir_score(110, 250, 35, 32)
Modified Early Warning Score (MEWS)
Description
Calculates the Modified Early Warning Score (MEWS), a bedside scoring system used to identify patients at risk of catastrophic clinical deterioration (e.g., cardiac arrest, ICU admission). The score evaluates five physiological parameters: Systolic Blood Pressure, Heart Rate, Respiratory Rate, Temperature, and Level of Consciousness (AVPU).
Usage
mews_score(systolic_bp, heart_rate, respiratory_rate, temp_c, avpu_score)
Arguments
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
heart_rate |
Numeric. Heart rate in beats per minute. |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. |
temp_c |
Numeric. Body temperature in degrees Celsius. |
avpu_score |
String. Level of consciousness. Options: "alert": Alert (0 points). "verbal": Responds to Voice / New Confusion (1 point). "pain": Responds to Pain (2 points). "unresponsive": Unresponsive (3 points). |
Value
A list containing:
MEWS_Score |
The calculated total score (Range 0-14). |
Risk_Level |
Classification (Low, Medium, High). |
Action |
Suggested clinical response based on the score threshold. |
References
Subbe CP, Kruger M, Rutherford P, Gemmel L. Validation of a modified Early Warning Score in medical admissions. QJM. 2001;94(10):521-526. doi:10.1093/qjmed/94.10.521
Examples
# Example 1: Stable Patient
# SBP 120, HR 70, RR 12, Temp 37, Alert
mews_score(120, 70, 12, 37.0, "alert")
# Example 2: Critical Patient (High Risk)
# SBP 85 (+1), HR 115 (+2), RR 25 (+2), Temp 39 (+2), Verbal (+1)
# Score = 8
mews_score(85, 115, 25, 39.0, "verbal")
Myasthenia Gravis Activities of Daily Living (MG-ADL)
Description
Calculates the MG-ADL score, an 8-item patient-reported scale assessing symptom severity and functional impact in Myasthenia Gravis. Each item is graded from 0 (normal) to 3 (severe), providing a total score ranging from 0 to 24. It correlates well with the Quantitative Myasthenia Gravis (QMG) score.
Usage
mg_adl_score(talking, chewing, swallowing, breathing, tooth_brushing,
combing_hair, standing_from_chair, double_vision, eyelid_droop)
Arguments
talking |
Numeric (0-3). 0: Normal. 1: Intermittent slurring/nasal speech. 2: Constant slurring/nasal, but understandable. 3: Difficult to understand speech. |
chewing |
Numeric (0-3). 0: Normal. 1: Fatigue with solid food. 2: Fatigue with soft food. 3: Gastric tube. |
swallowing |
Numeric (0-3). 0: Normal. 1: Fatigue with some foods. 2: Incomplete swallowing/choking. 3: Gastric tube. |
breathing |
Numeric (0-3). 0: Normal. 1: SOB with exertion. 2: SOB at rest. 3: Ventilator dependence. |
tooth_brushing |
Numeric (0-3). Impairment of ability to brush teeth or comb hair (Note: MDCalc often separates these or groups arms; standard MG-ADL groups "Brushing teeth or combing hair" as one item. If inputs differ, map to the most severe). 0: None. 1: Extra effort, no rest periods. 2: Rest periods needed. 3: Cannot do. |
combing_hair |
Numeric (0-3). See above. Usually combined with tooth brushing in the standard 8-item scale. |
standing_from_chair |
Numeric (0-3). Arising from a chair. 0: Normal. 1: Uses arms. 2: Uses arms, multiple attempts. 3: Needs assistance. |
double_vision |
Numeric (0-3). 0: None. 1: Occurs, but not daily. 2: Daily, but not constant. 3: Constant. |
eyelid_droop |
Numeric (0-3). 0: None. 1: Occurs, but not daily. 2: Daily, but not constant. 3: Constant. |
Value
A list containing:
MG_ADL_Score |
The calculated total score (Range 0-24). |
Interpretation |
Clinical context regarding score changes. |
References
Wolfe GI, Herbelin L, Nations SP, et al. Myasthenia gravis activities of daily living profile. Neurology. 1999;52(7):1487-1489. doi:10.1212/wnl.52.7.1487
Examples
# Example 1: Moderate Disease
# Slurred speech (1), Fatigue chewing solids (1), Occasional diplopia (1), others 0
# Score = 3
mg_adl_score(1, 1, 0, 0, 0, 0, 0, 1, 0)
# Example 2: Severe Disease
# Choking (2), SOB at rest (2), Cannot brush teeth (3), Constant ptosis (3)
# Score = 10
mg_adl_score(0, 0, 2, 2, 3, 3, 0, 0, 3)
Myasthenia Gravis Foundation of America (MGFA) Clinical Classification
Description
Determines the MGFA Clinical Classification for patients with Myasthenia Gravis. This system categorizes patients based on the distribution and severity of muscle weakness (ocular vs. generalized) and the specific muscle groups primarily affected (limb/axial vs. oropharyngeal/respiratory).
Usage
mgfa_classification(intubated, ocular_weakness_only, generalized_severity,
predominant_symptoms)
Arguments
intubated |
Numeric (0 or 1). Is the patient currently intubated (excluding routine postoperative management)? (1 = Yes). This defines Class V. |
ocular_weakness_only |
Numeric (0 or 1). Is weakness restricted ONLY to ocular muscles (including eye closure)? (1 = Yes). This defines Class I. |
generalized_severity |
String. Severity of weakness affecting non-ocular muscles. Options: "mild" (Class II), "moderate" (Class III), "severe" (Class IV). Required if ocular_weakness_only is 0. |
predominant_symptoms |
String. The muscle groups primarily affected. "limb_axial": Predominantly limb and/or axial muscles (Subtype a). "oropharyngeal_respiratory": Predominantly oropharyngeal and/or respiratory muscles (Subtype b). |
Value
A list containing:
MGFA_Class |
The determined classification (e.g., Class I, Class IIa, Class IVb, Class V). |
Description |
The clinical definition of the classification. |
References
Jaretzki A 3rd, Barohn RJ, Ernstoff RM, et al. Myasthenia gravis: recommendations for clinical research standards. Task Force of the Medical Scientific Advisory Board of the Myasthenia Gravis Foundation of America. Neurology. 2000;55(1):16-23. doi:10.1212/wnl.55.1.16
Examples
# Example 1: Mild Generalized, Limb Predominant
mgfa_classification(0, 0, "mild", "limb_axial")
# Example 2: Severe Bulbar Symptoms
mgfa_classification(0, 0, "severe", "oropharyngeal_respiratory")
# Example 3: Ocular Myasthenia
mgfa_classification(0, 1, "none", "none")
Michigan Risk Score for PICC-Related Thrombosis
Description
Calculates the Michigan Risk Score to estimate the probability of symptomatic deep vein thrombosis (DVT) associated with the placement of a Peripherally Inserted Central Catheter (PICC). The score stratifies patients into four risk classes based on five clinical variables.
Usage
michigan_picc_risk_score(history_thrombosis, multilumen_catheter, active_cancer,
another_cvc_present, wbc_gt_12000)
Arguments
history_thrombosis |
Numeric (0 or 1). History of Deep Vein Thrombosis (DVT). (1 = Yes, +2 points). |
multilumen_catheter |
Numeric (0 or 1). Is the PICC multi-lumen (2 or more lumens)? (1 = Yes, +1 point). |
active_cancer |
Numeric (0 or 1). Active cancer (treated within the last 6 months). (1 = Yes, +3 points). |
another_cvc_present |
Numeric (0 or 1). Is another Central Venous Catheter (CVC) present at the time of placement? (1 = Yes, +1 point). |
wbc_gt_12000 |
Numeric (0 or 1). White Blood Cell count > 12,000 cells/mm^3 at the time of placement? (1 = Yes, +1 point). |
Value
A list containing:
MRS_Score |
The calculated total score (Range 0-8). |
Risk_Class |
Classification (Class I: 0, Class II: 1-2, Class III: 3, Class IV: >=4). |
Est_Thrombosis_Risk |
Estimated percentage risk of PICC-related thrombosis. |
References
Chopra V, Flanders SA, Saint S, et al. The Michigan Risk Score to predict peripherally inserted central catheter-associated thrombosis. J Thromb Haemost. 2017;15(10):1951-1962. doi:10.1111/jth.13794
Examples
# Example 1: High Risk (Class IV)
# Active Cancer (+3), Multi-lumen (+1), WBC >12k (+1)
# Score = 5
michigan_picc_risk_score(0, 1, 1, 0, 1)
# Example 2: Low Risk (Class I)
# No risk factors
# Score = 0
michigan_picc_risk_score(0, 0, 0, 0, 0)
Migraine Disability Assessment (MIDAS)
Description
Calculates the MIDAS score to evaluate headache-related disability over the past 3 months. The score sums the number of days of lost or significantly reduced activity across three domains: work/school, household work, and family/social activities.
Usage
midas_migraine_score(missed_work_school, reduced_work_school, missed_housework,
reduced_housework, missed_social_leisure)
Arguments
missed_work_school |
Numeric. Days missed from work or school in the last 3 months. |
reduced_work_school |
Numeric. Days with productivity at work or school reduced by half or more (excluding missed days) in the last 3 months. |
missed_housework |
Numeric. Days did not do household work (chores, repairs, shopping, caring for family) in the last 3 months. |
reduced_housework |
Numeric. Days with productivity in household work reduced by half or more (excluding missed days) in the last 3 months. |
missed_social_leisure |
Numeric. Days missed family, social, or leisure activities in the last 3 months. |
Value
A list containing:
MIDAS_Score |
The calculated total score (Sum of days). |
Grade |
The severity grade (I-IV). |
Interpretation |
Description of the disability level (Little/No, Mild, Moderate, Severe). |
References
Stewart WF, Lipton RB, Dowson AJ, Sawyer J. Development and testing of the Migraine Disability Assessment (MIDAS) Questionnaire to assess headache-related disability. Neurology. 2001;56(6 Suppl 1):S20-28. doi:10.1212/wnl.56.suppl_1.s20
Examples
# Example 1: Severe Disability
# Missed work 5, Reduced work 10, Missed home 5, Reduced home 10, Missed social 5
# Score = 35
midas_migraine_score(5, 10, 5, 10, 5)
# Example 2: Little or No Disability
# Missed work 0, Reduced work 2, Missed home 0, Reduced home 1, Missed social 0
# Score = 3
midas_migraine_score(0, 2, 0, 1, 0)
Milan Criteria for Liver Transplantation
Description
Determines eligibility for liver transplantation in patients with cirrhosis and hepatocellular carcinoma (HCC) based on the Milan Criteria. These criteria identify patients with small, unresectable HCCs who are likely to have good post-transplant outcomes.
Usage
milan_criteria_liver_transplant(num_tumors, max_tumor_size_cm,
extra_hepatic_spread, vascular_invasion)
Arguments
num_tumors |
Numeric. Total number of tumor nodules. |
max_tumor_size_cm |
Numeric. Diameter of the largest tumor nodule in centimeters. |
extra_hepatic_spread |
Numeric (0 or 1). Presence of extra-hepatic manifestations (metastases). (1 = Yes). |
vascular_invasion |
Numeric (0 or 1). Presence of macrovascular invasion. (1 = Yes). |
Value
A list containing:
Result |
Eligibility status ("Eligible" or "Not Eligible"). |
Explanation |
The specific rule component that determined the result. |
References
Mazzaferro V, Regalia E, Doci R, et al. Liver transplantation for the treatment of small hepatocellular carcinomas in patients with cirrhosis. N Engl J Med. 1996;334(11):693-699. doi:10.1056/NEJM199603143341104
Examples
# Example 1: Eligible (Single small tumor)
# 1 tumor, 4.5 cm, No spread/invasion
milan_criteria_liver_transplant(1, 4.5, 0, 0)
# Example 2: Not Eligible (Too large)
# 2 tumors, largest 4.0 cm (Limit for multiple is 3 cm)
milan_criteria_liver_transplant(2, 4.0, 0, 0)
# Example 3: Eligible (Multiple small tumors)
# 3 tumors, largest 2.8 cm
milan_criteria_liver_transplant(3, 2.8, 0, 0)
Mantle Cell Lymphoma International Prognostic Index (MIPI)
Description
Calculates the MIPI score to predict overall survival in patients with advanced-stage mantle cell lymphoma (MCL). The score is a continuous variable derived from age, ECOG performance status, lactate dehydrogenase (LDH) ratio, and white blood cell (WBC) count.
Usage
mipi_lymphoma_score(age, ecog_score, ldh_level, ldh_uln, wbc_count)
Arguments
age |
Numeric. Patient age in years. |
ecog_score |
Numeric. Eastern Cooperative Oncology Group (ECOG) performance status (0-4). Scores 0-1 are weighted as 0; scores 2-4 are weighted as 1 in the algorithm. |
ldh_level |
Numeric. Patient's serum LDH level. |
ldh_uln |
Numeric. The laboratory's Upper Limit of Normal for LDH. |
wbc_count |
Numeric. White Blood Cell count in x10^9/L (or cells/uL / 1000). |
Value
A list containing:
MIPI_Score |
The calculated prognostic score. |
Risk_Group |
Classification (Low < 5.7, Intermediate 5.7-6.2, High >= 6.2). |
Median_Overall_Survival |
Estimated median survival time based on the original cohort. |
References
Hoster E, Dreyling M, Klapper W, et al. A new prognostic index (MIPI) for patients with advanced-stage mantle cell lymphoma. Blood. 2008;111(2):558-565. doi:10.1182/blood-2007-06-095331
Examples
# Example 1: High Risk
# Age 80 (2.8), ECOG 3 (0.7), LDH 1000/200 (Ratio 5 -> log10(5)=0.7, 1.367*0.7=0.95),
#WBC 50 (log10(50)=1.7, 0.94*1.7=1.6)
# Sum = 2.8 + 0.7 + 0.95 + 1.6 = 6.05 (Intermediate).
mipi_lymphoma_score(80, 3, 1000, 200, 50)
# Example 2: Low Risk
# Age 50, ECOG 0, LDH 150 (ULN 200 -> 0.75), WBC 5
# Score = 1.76 + 0 + (1.367 * -0.12) + (0.9393 * 0.7) = 1.76 - 0.16 + 0.66 = 2.26
mipi_lymphoma_score(50, 0, 150, 200, 5)
Mutation-Enhanced International Prognostic Score System (MIPSS70 and MIPSS70+) for Primary Myelofibrosis
Description
Calculates the MIPSS70 and MIPSS70+ scores for risk stratification in patients with Primary Myelofibrosis (PMF) aged <= 70 years. The score integrates clinical risk factors, fibrosis grade, and mutational status (CALR, ASXL1, EZH2, SRSF2, IDH1/2). The MIPSS70+ version includes cytogenetic data.
Usage
mipss70_score(hemoglobin_g_l, wbc_x10_9_l, platelets_x10_9_l, blasts_percent,
fibrosis_grade_ge_2, constitutional_symptoms, calr_type1_absent,
hmr_mutation_count, karyotype_unfavorable = NULL)
Arguments
hemoglobin_g_l |
Numeric. Hemoglobin level in g/L. (< 100 g/L adds 1 point). |
wbc_x10_9_l |
Numeric. White Blood Cell count in 10^9/L. (> 25 x 10^9/L adds 2 points). |
platelets_x10_9_l |
Numeric. Platelet count in 10^9/L. (< 100 x 10^9/L adds 2 points). |
blasts_percent |
Numeric. Percentage of circulating blasts. (>= 2% adds 1 point). |
fibrosis_grade_ge_2 |
Numeric (0 or 1). Is bone marrow fibrosis grade >= 2? (1 = Yes, +1 point). |
constitutional_symptoms |
Numeric (0 or 1). Presence of constitutional symptoms (fever, weight loss, night sweats). (1 = Yes, +1 point). |
calr_type1_absent |
Numeric (0 or 1). Absence of CALR type 1 mutation. (1 = Yes, +1 point). |
hmr_mutation_count |
Numeric. Count of High Molecular Risk (HMR) mutations present (ASXL1, EZH2, SRSF2, IDH1, IDH2). 0: 0 pts. 1: 1 pt. >=2: 2 pts. |
karyotype_unfavorable |
Numeric (0 or 1) (Optional). Presence of unfavorable karyotype (e.g., complex karyotype, sole or two abnormalities including +8, -7/7q-, i(17q), inv(3), 5q-, 12p-, 11q23 rearrangement). If provided, calculates MIPSS70+ score. (1 = Yes, +3 points). |
Value
A list containing:
MIPSS70_Score |
The calculated score based on clinical and molecular factors. |
MIPSS70_Risk_Category |
Risk group (Low, Intermediate, High). |
MIPSS70_Plus |
A list containing the MIPSS70+ Score and Risk Category if karyotype data was provided. |
References
Tefferi A, Guglielmelli P, Lasho TL, et al. MIPSS70: Mutation-Enhanced International Prognostic Score System for Transplantation-Age Patients With Primary Myelofibrosis. J Clin Oncol. 2018;36(4):310-318. doi:10.1200/JCO.2017.76.4886
Examples
# Example 1: MIPSS70 High Risk
# Hb 90 (+1), WBC 30 (+2), HMR 2 (+2)
mipss70_score(90, 30, 150, 0, 0, 0, 0, 2)
# Example 2: MIPSS70+ Very High Risk
# Hb 110, Plt 80 (+2), Fibrosis 2 (+1), Unfavorable Karyotype (+3)
mipss70_score(110, 10, 80, 0, 1, 0, 0, 0, 1)
Mirels' Criteria for Prophylactic Fixation
Description
Calculates the Mirels' Score to assess the risk of pathological fracture in long bones due to metastatic disease. The score evaluates four parameters: site, pain, lesion type, and lesion size. It helps determine whether prophylactic surgical fixation or radiotherapy is the appropriate management strategy.
Usage
mirels_fracture_score(site, pain, lesion_type, size_ratio)
Arguments
site |
String. Location of the lesion. "upper_limb": Upper extremity (1 pt). "lower_limb": Lower extremity (2 pts). "peritrochanteric": Peritrochanteric region (3 pts). |
pain |
String. Severity of pain. "mild": Mild pain (1 pt). "moderate": Moderate pain (2 pts). "functional": Functional/Severe pain (3 pts). |
lesion_type |
String. Radiographic appearance of the lesion. "blastic": Blastic (1 pt). "mixed": Mixed (2 pts). "lytic": Lytic (3 pts). |
size_ratio |
String. Size of the lesion relative to the bone diameter. "lt_one_third": < 1/3 of bone diameter (1 pt). "one_third_to_two_thirds": 1/3 - 2/3 of bone diameter (2 pts). "gt_two_thirds": > 2/3 of bone diameter (3 pts). |
Value
A list containing:
Mirels_Score |
The calculated total score (Range 4-12). |
Recommendation |
Clinical guidance based on the score threshold (Fixation indicated for score >= 9). |
Est_Fracture_Risk |
Estimated risk of pathological fracture. |
References
Mirels H. Metastatic disease in long bones. A proposed scoring system for diagnosing impending pathologic fractures. Clin Orthop Relat Res. 1989;(249):256-264.
Examples
# Example 1: High Risk
# Peritrochanteric (3), Functional pain (3), Lytic (3), >2/3 size (3)
# Score = 12
mirels_fracture_score("peritrochanteric", "functional", "lytic", "gt_two_thirds")
# Example 2: Low Risk
# Upper limb (1), Mild pain (1), Blastic (1), <1/3 size (1)
# Score = 4
mirels_fracture_score("upper_limb", "mild", "blastic", "lt_one_third")
Modified Medical Research Council (mMRC) Dyspnea Scale
Description
Retrieves the description for the Modified Medical Research Council (mMRC) Dyspnea Scale grade. This scale quantifies the disability associated with breathlessness in patients with respiratory diseases, particularly COPD, by assessing the level of activity that provokes dyspnea.
Usage
mmrc_dyspnea_scale(grade)
Arguments
grade |
Numeric (0-4). The patient's selected grade. 0: Breathless only with strenuous exercise. 1: Short of breath when hurrying or walking up a slight hill. 2: Walks slower than contemporaries or stops for breath when walking at own pace. 3: Stops for breath after 100m or a few minutes. 4: Too breathless to leave house or breathless when dressing. |
Value
A list containing:
mMRC_Grade |
The input grade. |
Description |
The clinical description of the patient's functional limitation due to dyspnea. |
References
Fletcher CM. The clinical diagnosis of pulmonary emphysema; an experimental study. Proc R Soc Med. 1952;45(9):577-584. Bestall JC, Paul EA, Garrod R, Garnham R, Jones PW, Wedzicha JA. Usefulness of the Medical Research Council (MRC) dyspnoea scale as a measure of disability in patients with chronic obstructive pulmonary disease. Thorax. 1999;54(7):581-586. doi:10.1136/thx.54.7.581
Examples
# Example 1: Grade 2 (Moderate impairment)
mmrc_dyspnea_scale(2)
# Example 2: Grade 4 (Severe impairment)
mmrc_dyspnea_scale(4)
Montreal Cognitive Assessment (MoCA)
Description
Calculates the MoCA score, a rapid screening instrument for mild cognitive dysfunction. It assesses different cognitive domains: attention and concentration, executive functions, memory, language, visuoconstructional skills, conceptual thinking, calculations, and orientation. A score of 26 or above is considered normal. One point is added for subjects with 12 or fewer years of formal education (if total score is < 30).
Usage
moca_cognitive_assessment(visuospatial, naming, attention, language, abstraction,
delayed_recall, orientation, education_years)
Arguments
visuospatial |
Numeric (0-5). Score for Visuospatial/Executive tasks (e.g., Trail Making B, Cube Copy, Clock Drawing). |
naming |
Numeric (0-3). Score for Naming task (e.g., Lion, Rhino, Camel). |
attention |
Numeric (0-6). Score for Attention tasks (Digit span, Letter A tap, Serial 7s). |
language |
Numeric (0-3). Score for Language tasks (Sentence repetition, Verbal fluency). |
abstraction |
Numeric (0-2). Score for Abstraction task (Similarity pairs). |
delayed_recall |
Numeric (0-5). Score for Delayed Recall (5 words). |
orientation |
Numeric (0-6). Score for Orientation (Date, Month, Year, Day, Place, City). |
education_years |
Numeric. Total years of formal education. Used to calculate the education adjustment (+1 if <= 12 years). |
Value
A list containing:
MoCA_Score |
The calculated total score (Max 30). |
Interpretation |
Clinical interpretation of the score (Normal vs Impairment levels). |
Education_Adjustment |
Indication if the education point was applied. |
References
Nasreddine ZS, Phillips NA, Bédirian V, et al. The Montreal Cognitive Assessment, MoCA: a brief screening tool for mild cognitive impairment. J Am Geriatr Soc. 2005;53(4):695-699. doi:10.1111/j.1532-5415.2005.53221.x
Examples
# Example 1: Normal Cognition
# All sections perfect, >12 years education
moca_cognitive_assessment(5, 3, 6, 3, 2, 5, 6, 16)
# Example 2: Mild Impairment with Education Bonus
# Raw score 22, 10 years education (+1 point)
# Result: 23
moca_cognitive_assessment(3, 3, 5, 2, 1, 3, 5, 10)
Modified Asthma Predictive Index (mAPI)
Description
Calculates the Modified Asthma Predictive Index (mAPI) for young children (<= 3 years) with frequent wheezing. A positive mAPI predicts a high likelihood of developing asthma by school age. The index requires frequent wheezing (>3 episodes/year) plus either 1 Major criterion or 2 Minor criteria.
Usage
modified_asthma_predictive_index(age, wheezing_episodes_gt_3_per_year,
parental_asthma, eczema, aeroallergen_sensitization,
food_sensitization, wheezing_apart_from_colds,
eosinophilia_gt_4_percent)
Arguments
age |
Numeric. Age of the child in years. (Tool is validated for young children, typically <= 3). |
wheezing_episodes_gt_3_per_year |
Numeric (0 or 1). Does the child have >3 episodes of wheezing per year? (1 = Yes). This is a prerequisite for a positive score. |
parental_asthma |
Numeric (0 or 1). Parent with physician-diagnosed asthma. (Major Criterion). |
eczema |
Numeric (0 or 1). Physician-diagnosed atopic dermatitis (eczema). (Major Criterion). |
aeroallergen_sensitization |
Numeric (0 or 1). Sensitization to at least one aeroallergen (positive skin prick test or specific IgE). (Major Criterion). |
food_sensitization |
Numeric (0 or 1). Sensitization to milk, eggs, or peanuts. (Minor Criterion). |
wheezing_apart_from_colds |
Numeric (0 or 1). Wheezing apart from colds. (Minor Criterion). |
eosinophilia_gt_4_percent |
Numeric (0 or 1). Peripheral blood eosinophilia >= 4%. (Minor Criterion). |
Value
A list containing:
mAPI_Result |
"Positive mAPI" or "Negative mAPI". |
Prediction |
Prognostic interpretation regarding future asthma development. |
Criteria_Met |
Summary of major and minor criteria counts. |
References
Guilbert TW, Morgan WJ, Zeiger RS, et al. Atopic characteristics of children with recurrent wheezing at high risk for the development of childhood asthma. J Allergy Clin Immunol. 2004;114(6):1282-1287. doi:10.1016/j.jaci.2004.09.020 Chang TS, Lemanske RF Jr, Guilbert TW, et al. Evaluation of the modified asthma predictive index in high-risk preschool children. J Allergy Clin Immunol Pract. 2013;1(2):152-156. doi:10.1016/j.jaip.2012.10.008
Examples
# Example 1: Positive mAPI
# Frequent wheezing (1), Eczema (1 Major), Eosinophilia
#(1 Minor - insufficient alone, but 1 major is enough)
# Result: Positive
modified_asthma_predictive_index(2, 1, 0, 1, 0, 0, 0, 1)
# Example 2: Negative mAPI
# Frequent wheezing (1), Only 1 Minor (Eosinophilia)
# Result: Negative
modified_asthma_predictive_index(3, 1, 0, 0, 0, 0, 0, 1)
Modified Bishop Score for Vaginal Delivery
Description
Calculates the Modified Bishop Score to assess the readiness of the cervix for induction of labor. The score evaluates five parameters: Dilation, Effacement, Station, Consistency, and Position. A higher score indicates a more favorable cervix for successful vaginal delivery.
Usage
modified_bishop_score(dilation_cm, effacement_percent, station,
consistency, position)
Arguments
dilation_cm |
Numeric. Cervical dilation in centimeters. 0 cm: 0 pts. 1-2 cm: 1 pt. 3-4 cm: 2 pts. >= 5 cm: 3 pts. |
effacement_percent |
Numeric. Cervical effacement percentage. 0-30%: 0 pts. 40-50%: 1 pt. 60-70%: 2 pts. >= 80%: 3 pts. |
station |
Numeric. Fetal station relative to ischial spines (-3 to +2). -3: 0 pts. -2: 1 pt. -1, 0: 2 pts. +1, +2: 3 pts. |
consistency |
String. Consistency of the cervix. Options: "firm" (0 pts), "medium" (1 pt), "soft" (2 pts). |
position |
String. Position of the cervix. Options: "posterior" (0 pts), "midposition" (1 pt), "anterior" (2 pts). |
Value
A list containing:
Bishop_Score |
The calculated total score (Range 0-13). |
Interpretation |
Clinical assessment (Favorable > 8, Unfavorable < 6). |
References
Laughon SK, Zhang J, Troendle J, Sun L, Reddy UM. Using a simplified Bishop score to predict vaginal delivery. Obstet Gynecol. 2011;117(4):805-811. doi:10.1097/AOG.0b013e3182114ad2
Examples
# Example 1: Favorable Cervix
# 4cm dilated (2), 60% effaced (2), -1 station (2), Soft (2), Anterior (2)
# Score = 10
modified_bishop_score(4, 60, -1, "soft", "anterior")
# Example 2: Unfavorable Cervix
# Closed (0), 30% effaced (0), -3 station (0), Firm (0), Posterior (0)
# Score = 0
modified_bishop_score(0, 30, -3, "firm", "posterior")
Modified Fatigue Impact Scale (MFIS)
Description
Calculates the Modified Fatigue Impact Scale (MFIS) score, a 21-item assessment derived from the Fatigue Impact Scale. It evaluates the effects of fatigue on physical, cognitive, and psychosocial functioning in patients with Multiple Sclerosis (MS).
Usage
modified_fatigue_impact_scale(q1, q2, q3, q4, q5, q6, q7, q8, q9, q10,
q11, q12, q13, q14, q15, q16, q17, q18,
q19, q20, q21)
Arguments
q1 |
Numeric (0-4). I have been less alert. |
q2 |
Numeric (0-4). I have had difficulty paying attention for long periods of time. |
q3 |
Numeric (0-4). I have been unable to think clearly. |
q4 |
Numeric (0-4). I have been clumsy and uncoordinated. |
q5 |
Numeric (0-4). I have been forgetful. |
q6 |
Numeric (0-4). I have had to pace myself in my physical activities. |
q7 |
Numeric (0-4). I have been less motivated to do anything that requires physical effort. |
q8 |
Numeric (0-4). I have been less motivated to participate in social activities. |
q9 |
Numeric (0-4). I have been limited in my ability to do things away from home. |
q10 |
Numeric (0-4). I have had trouble maintaining physical effort for long periods. |
q11 |
Numeric (0-4). I have had difficulty making decisions. |
q12 |
Numeric (0-4). I have been less motivated to do anything that requires thinking. |
q13 |
Numeric (0-4). My muscles have felt weak. |
q14 |
Numeric (0-4). I have been physically uncomfortable. |
q15 |
Numeric (0-4). I have had trouble finishing tasks that require thinking. |
q16 |
Numeric (0-4). I have had difficulty organizing my thoughts when doing things at home or work. |
q17 |
Numeric (0-4). I have been less able to complete tasks that require physical effort. |
q18 |
Numeric (0-4). My thinking has been slowed down. |
q19 |
Numeric (0-4). I have had trouble concentrating. |
q20 |
Numeric (0-4). I have limited my physical activities. |
q21 |
Numeric (0-4). I have needed to rest more often or for longer periods. |
Details
Scoring Key: 0 = Never 1 = Rarely 2 = Sometimes 3 = Often 4 = Almost always
Subscales: Physical: Q4, 6, 7, 10, 13, 14, 17, 20, 21 (Range 0-36) Cognitive: Q1, 2, 3, 5, 11, 12, 15, 16, 18, 19 (Range 0-40) Psychosocial: Q8, 9 (Range 0-8)
Value
A list containing:
MFIS_Total_Score |
The calculated total score (Range 0-84). |
Impact_Interpretation |
Classification based on the cutoff of 38 (predictive of clinically significant fatigue). |
Subscales |
A list containing the Physical, Cognitive, and Psychosocial domain scores. |
References
Multiple Sclerosis Council for Clinical Practice Guidelines. Fatigue and Multiple Sclerosis: Evidence-Based Management Strategies for Fatigue in Multiple Sclerosis. Washington, DC: Paralyzed Veterans of America; 1998.
Examples
# Example 1: High Impact
# All items scored 3
modified_fatigue_impact_scale(3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3)
# Example 2: Low Impact
# All items scored 1
modified_fatigue_impact_scale(1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
Modified Finnegan Neonatal Abstinence Score (NAS)
Description
Calculates the Modified Finnegan Score to assess the severity of Neonatal Abstinence Syndrome (NAS) in infants exposed to opioids or other substances in utero. The score evaluates 21 symptoms across CNS, metabolic/vasomotor/respiratory, and gastrointestinal domains.
Usage
modified_finnegan_nas_score(cry_score, sleep_score, moro_reflex_score,
tremors_score, increased_muscle_tone, excoriation,
myoclonic_jerks, generalized_convulsions, sweating,
fever_score, frequent_yawning, mottling, nasal_stuffiness,
frequent_sneezing, nasal_flaring, respiration_score,
excessive_sucking, poor_feeding, projectile_vomiting,
stool_score)
Arguments
cry_score |
Numeric. 0: Normal; 2: High pitched; 3: Continuous high pitched. |
sleep_score |
Numeric. 0: Sleeps >3 hours after feeding; 1: Sleeps 2-3 hours; 2: Sleeps 1-2 hours; 3: Sleeps <1 hour. |
moro_reflex_score |
Numeric. 0: Normal; 2: Hyperactive; 3: Markedly hyperactive. |
tremors_score |
Numeric. 0: Normal; 1: Disturbed, mild; 2: Disturbed, marked; 3: Undisturbed, mild; 4: Undisturbed, marked. |
increased_muscle_tone |
Numeric (0 or 1). 1 = Yes (+2 points). |
excoriation |
Numeric (0 or 1). 1 = Yes (+1 point). |
myoclonic_jerks |
Numeric (0 or 1). 1 = Yes (+3 points). |
generalized_convulsions |
Numeric (0 or 1). 1 = Yes (+5 points). |
sweating |
Numeric (0 or 1). 1 = Yes (+1 point). |
fever_score |
Numeric. 0: <37.2 C; 1: 37.2-38.3 C; 2: >38.4 C. |
frequent_yawning |
Numeric (0 or 1). >3-4 times/interval. (1 = Yes, +1 point). |
mottling |
Numeric (0 or 1). 1 = Yes (+1 point). |
nasal_stuffiness |
Numeric (0 or 1). 1 = Yes (+1 point). |
frequent_sneezing |
Numeric (0 or 1). >3-4 times/interval. (1 = Yes, +1 point). |
nasal_flaring |
Numeric (0 or 1). 1 = Yes (+2 points). |
respiration_score |
Numeric. 0: <60/min; 1: >60/min; 2: >60/min with retractions. |
excessive_sucking |
Numeric (0 or 1). 1 = Yes (+1 point). |
poor_feeding |
Numeric (0 or 1). Infrequent/uncoordinated feeding. (1 = Yes, +2 points). |
projectile_vomiting |
Numeric (0 or 1). 1 = Yes (+2 points). |
stool_score |
Numeric. 0: Normal; 2: Loose; 3: Watery. |
Value
A list containing:
NAS_Score |
The calculated total score. |
Recommendation |
General clinical guidance based on the score threshold of 8. |
References
Finnegan LP, Connaughton JF Jr, Kron RE, Emich JP. Neonatal abstinence syndrome: assessment and management. Addict Dis. 1975;2(1-2):141-158.
Examples
# Example 1: Moderate Withdrawal
# High cry (2), Sleep 1-2h (2), Tremors mild dist (1), Sweating (1), Loose stool (2)
modified_finnegan_nas_score(2, 2, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2)
# Example 2: Severe Withdrawal
# Continuous cry (3), Sleep <1h (3), Tremors undisturbed marked (4),
# Fever >38.4 (2), Watery stool (3)
modified_finnegan_nas_score(3, 3, 0, 4, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3)
Modified Fisher Grading Scale for Subarachnoid Hemorrhage
Description
Calculates the Modified Fisher Grade, an updated radiographic scale for predicting the risk of delayed cerebral ischemia (vasospasm) following subarachnoid hemorrhage. Unlike the original Fisher scale, this version specifically accounts for the presence of intraventricular hemorrhage (IVH) and thick cisternal blood separately.
Usage
modified_fisher_grade(sah_present, ich_ivh_present, clot_thickness_ge_1mm)
Arguments
sah_present |
Numeric (0 or 1). Is subarachnoid hemorrhage present? (1 = Yes). |
ich_ivh_present |
Numeric (0 or 1). Is intraventricular hemorrhage (IVH) present? (1 = Yes). |
clot_thickness_ge_1mm |
Numeric (0 or 1). Is the SAH clot thick (>= 1 mm)? (1 = Yes). |
Value
A list containing:
Modified_Fisher_Grade |
The calculated grade (0-4). |
CT_Findings |
Description of the radiographic pattern. |
Symptomatic_Vasospasm_Risk |
Estimated risk percentage. |
References
Claassen J, Bernardini GL, Kreiter K, et al. Effect of cisternal and ventricular blood on risk of delayed cerebral ischemia after subarachnoid hemorrhage: the Fisher scale revisited. Stroke. 2001;32(9):2012-2020. doi:10.1161/hs0901.095677
Examples
# Example 1: Highest Risk (Grade 4)
# Thick SAH (1), IVH (1)
modified_fisher_grade(1, 1, 1)
# Example 2: Intermediate Risk (Grade 2)
# Thin SAH (0), IVH (1)
modified_fisher_grade(1, 1, 0)
Modified Glasgow Prognostic Score (mGPS)
Description
Calculates the Modified Glasgow Prognostic Score (mGPS) to predict survival outcomes in patients with operable and inoperable cancer. Unlike the original GPS, the mGPS assigns a score of 0 to patients with hypoalbuminemia if their CRP is normal, as isolated hypoalbuminemia is less strongly associated with cancer cachexia-related mortality.
Usage
modified_gps_score(crp_mg_l, albumin_g_l)
Arguments
crp_mg_l |
Numeric. Serum C-Reactive Protein level in mg/L. |
albumin_g_l |
Numeric. Serum Albumin level in g/L. |
Details
Scoring Criteria:
-
Score 0: CRP <= 10 mg/L (regardless of Albumin level).
-
Score 1: CRP > 10 mg/L AND Albumin >= 35 g/L.
-
Score 2: CRP > 10 mg/L AND Albumin < 35 g/L.
Value
A list containing:
mGPS_Score |
The calculated score (0, 1, or 2). |
Prognosis |
Risk classification (Good, Intermediate, Poor). |
References
McMillan DC. The systemic inflammation-based Glasgow Prognostic Score: a decade of experience in patients with cancer. Cancer Treat Rev. 2013;39(5):534-540. doi:10.1016/j.ctrv.2012.08.003
Examples
# Example 1: Low Risk (Normal CRP)
# CRP 8, Albumin 30 (Hypoalbuminemia ignored in mGPS)
# Score = 0
modified_gps_score(8, 30)
# Example 2: High Risk
# CRP 25, Albumin 28
# Score = 2
modified_gps_score(25, 28)
Modified Hoehn and Yahr Scale for Parkinson's Disease
Description
Retrieves the clinical description for the Modified Hoehn and Yahr Scale. This system stages the severity of Parkinson's disease based on clinical findings regarding unilateral versus bilateral involvement and the preservation of postural reflexes.
Usage
modified_hoehn_yahr_scale(stage)
Arguments
stage |
Numeric. The assessed stage of the patient. 1.0: Unilateral involvement only. 1.5: Unilateral and axial involvement. 2.0: Bilateral involvement without impairment of balance. 2.5: Mild bilateral disease with recovery on pull test. 3.0: Mild to moderate bilateral disease; some postural instability; physically independent. 4.0: Severe disability; still able to walk or stand unassisted. 5.0: Wheelchair bound or bedridden unless aided. |
Value
A list containing:
Hoehn_Yahr_Stage |
The input stage. |
Description |
The clinical definition associated with the stage. |
References
Goetz CG, Poewe W, Rascol O, et al. Movement Disorder Society Task Force report on the Hoehn and Yahr staging scale: status and recommendations. Mov Disord. 2004;19(9):1020-1028. doi:10.1002/mds.20213 Hoehn MM, Yahr MD. Parkinsonism: onset, progression and mortality. Neurology. 1967;17(5):427-442.
Examples
# Example 1: Stage 2.5 (Mild Bilateral)
modified_hoehn_yahr_scale(2.5)
# Example 2: Stage 5 (Severe)
modified_hoehn_yahr_scale(5)
Modified Mallampati Classification
Description
Retrieves the clinical description for the Modified Mallampati Classification. This system is used to predict the ease of endotracheal intubation based on the visibility of oropharyngeal structures.
Usage
modified_mallampati_classification(class_grade)
Arguments
class_grade |
Numeric (1-4). The assigned Mallampati Class. 1: Full visibility (Soft palate, fauces, uvula, pillars). 2: Partial visibility (Soft palate, fauces, uvula). 3: Limited visibility (Soft palate, base of uvula). 4: No visibility (Hard palate only). |
Value
A list containing:
Mallampati_Class |
The formatted class string. |
Visibility |
Description of visible anatomical structures. |
Intubation_Difficulty |
Estimated difficulty of intubation. |
References
Samsoon GL, Young JR. Difficult tracheal intubation: a retrospective study. Anaesthesia. 1987;42(5):487-490. doi:10.1111/j.1365-2044.1987.tb04039.x
Examples
# Example 1: Class I (Easy)
modified_mallampati_classification(1)
# Example 2: Class IV (Difficult)
modified_mallampati_classification(4)
Modified Minnesota Detoxification Scale (MMDS)
Description
Calculates the Modified Minnesota Detoxification Scale (MMDS) score, used to assess the severity of alcohol withdrawal and guide treatment. The scale evaluates vital signs (pulse, diastolic BP) and clinical signs (tremor, sweat, hallucinations, agitation, orientation, seizures).
Usage
modified_minnesota_detox_scale(pulse_rate, diastolic_bp, tremor, sweat,
hallucinations, agitation, orientation, seizures)
Arguments
pulse_rate |
Numeric. Patient's pulse rate in beats per minute. |
diastolic_bp |
Numeric. Patient's diastolic blood pressure in mmHg. |
tremor |
Numeric (0-3). Severity of tremor. (0: None, 1: Visible, 2: Marked, 3: Severe/Gross). |
sweat |
Numeric (0-3). Severity of sweating. (0: None, 1: Moist, 2: Bead/wet, 3: Drenching). |
hallucinations |
Numeric (0-3). Presence/severity of hallucinations. (0: None, 1: Mild/transient, 2: Moderate/distressing, 3: Severe/continuous). |
agitation |
Numeric (0-3). Severity of agitation. (0: None, 1: Restless, 2: Agitated, 3: Combative). |
orientation |
Numeric (0-4). Orientation score (based on time, place, person). Typically scored inversely (0: Oriented x3, 4: Disoriented). *Note: Specific MDCalc implementation details may vary, usually ranges 0-4 or similar.* |
seizures |
Numeric (0-2). Seizure activity. (0: None, 1: One, 2: Multiple). |
Value
A list containing:
MMDS_Score |
The calculated total score (Range 0-24+). |
Severity_Interpretation |
Assessment of withdrawal severity (e.g., >=10 suggests severe). |
References
DeMarce JM, Burden JL, Lash SJ, et al. Outcome of a modified Minnesota detoxification scale for alcohol withdrawal. Addict Behav. 2014;39(11):1670-1673. doi:10.1016/j.addbeh.2014.06.003
Examples
# Example 1: Severe Withdrawal
# Pulse 130 (3), DBP 115 (3), Severe Tremor (3), Drenching Sweat (3), Hallucinations (3)
# Score = 15+
modified_minnesota_detox_scale(130, 115, 3, 3, 3, 0, 0, 0)
# Example 2: Mild Withdrawal
# Pulse 90 (1), DBP 85 (0), Mild tremor (1), No other signs
# Score = 2
modified_minnesota_detox_scale(90, 85, 1, 0, 0, 0, 0, 0)
Modified NIH Stroke Scale (mNIHSS)
Description
Calculates the Modified NIH Stroke Scale (mNIHSS) score. This version of the NIHSS improves interrater reliability by removing items that are often difficult to score consistently, specifically Level of Consciousness (1A), Facial Palsy, Ataxia, and Dysarthria. It is validated for use in telemedicine and retrospective chart reviews.
Usage
modified_nih_stroke_scale(loc_questions, loc_commands, gaze, visual_fields,
motor_arm_left, motor_arm_right, motor_leg_left,
motor_leg_right, sensory, best_language,
extinction_inattention)
Arguments
loc_questions |
Numeric (0-2). LOC Questions (Month and Age). 0: Answers both correctly. 1: Answers one correctly. 2: Answers neither correctly. |
loc_commands |
Numeric (0-2). LOC Commands (Open/close eyes, grip/release hand). 0: Performs both tasks correctly. 1: Performs one task correctly. 2: Performs neither task correctly. |
gaze |
Numeric (0-2). Best Gaze. 0: Normal. 1: Partial gaze palsy. 2: Forced deviation. |
visual_fields |
Numeric (0-3). Visual Fields. 0: No visual loss. 1: Partial hemianopia. 2: Complete hemianopia. 3: Bilateral hemianopia. |
motor_arm_left |
Numeric (0-4). Motor Arm (Left). 0: No drift. 1: Drift. 2: Some effort against gravity. 3: No effort against gravity. 4: No movement. |
motor_arm_right |
Numeric (0-4). Motor Arm (Right). |
motor_leg_left |
Numeric (0-4). Motor Leg (Left). |
motor_leg_right |
Numeric (0-4). Motor Leg (Right). |
sensory |
Numeric (0-2). Sensory. 0: Normal. 1: Mild-to-moderate sensory loss. 2: Severe to total sensory loss. |
best_language |
Numeric (0-3). Best Language. 0: No aphasia. 1: Mild-to-moderate aphasia. 2: Severe aphasia. 3: Mute, global aphasia. |
extinction_inattention |
Numeric (0-2). Extinction and Inattention (formerly Neglect). 0: No abnormality. 1: Visual, tactile, auditory, spatial, or personal inattention. 2: Profound hemi-inattention or extinction to more than one modality. |
Value
A list containing:
mNIHSS_Score |
The calculated total score (Range 0-31). |
Severity |
Interpretation of stroke severity (Minor, Moderate, Severe). |
References
Meyer BC, Hemmen TM, Jackson CM, Lyden PD. Modified National Institutes of Health Stroke Scale for use in stroke clinical trials: reproducibility and validity. Stroke. 2002;33(5):1261-1266. doi:10.1161/01.str.0000015052.83017.8a
Examples
# Example 1: Moderate Stroke
# Incorrect age (1), Partial gaze (1), L-Arm drift (1), L-Leg drift (1), Mild aphasia (1)
modified_nih_stroke_scale(1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0)
# Example 2: Severe Stroke
# No commands (2), Forced gaze (2), Complete hemianopia (2),
# R-Arm/Leg paralysis (4, 4), Global aphasia (3), Neglect (2)
modified_nih_stroke_scale(0, 2, 2, 2, 0, 4, 0, 4, 0, 3, 2)
Modified Rankin Scale (mRS)
Description
Retrieves the clinical description for the Modified Rankin Scale (mRS) score. The mRS is a widely used scale for measuring the degree of disability or dependence in the daily activities of people who have suffered a stroke or other neurological disability.
Usage
modified_rankin_scale(score)
Arguments
score |
Numeric. The mRS score (0-6). 0: No symptoms. 1: No significant disability. 2: Slight disability. 3: Moderate disability. 4: Moderately severe disability. 5: Severe disability. 6: Dead. |
Value
A list containing:
mRS_Score |
The input score. |
Description |
The clinical definition associated with the score. |
References
Rankin J. Cerebral vascular accidents in patients over the age of 60. II. Prognosis. Scott Med J. 1957;2(5):200-215. van Swieten JC, Koudstaal PJ, Visser MC, Schouten HJ, van Gijn J. Interobserver agreement for the assessment of handicap in stroke patients. Stroke. 1988;19(5):604-607.
Examples
# Example 1: Slight Disability
modified_rankin_scale(2)
# Example 2: Severe Disability
modified_rankin_scale(5)
Modified Sgarbossa Criteria for MI with LBBB
Description
Evaluates the Modified Sgarbossa Criteria to diagnose Acute Myocardial Infarction (AMI) in the presence of Left Bundle Branch Block (LBBB) or Ventricular Paced Rhythm. This modification improves sensitivity over the original criteria by using a proportional ratio (ST/S ratio) for discordant ST elevation rather than an absolute cutoff.
Usage
modified_sgarbossa_criteria(st_elevation_concordant_mm, st_depression_v1_v3_mm,
st_elevation_discordant_mm, s_wave_amplitude_mm)
Arguments
st_elevation_concordant_mm |
Numeric. Magnitude of ST elevation (mm) in leads with a positive QRS complex (Concordant STE). (Criterion: >= 1 mm). |
st_depression_v1_v3_mm |
Numeric. Magnitude of ST depression (mm) in leads V1, V2, or V3 (Concordant STD). (Criterion: >= 1 mm). |
st_elevation_discordant_mm |
Numeric. Magnitude of ST elevation (mm) in leads with a negative QRS complex (Discordant STE). Used for ratio calculation. |
s_wave_amplitude_mm |
Numeric. Magnitude (depth) of the S-wave (mm) in the same lead as the discordant STE. Used for ratio calculation. |
Value
A list containing:
Result |
Diagnostic interpretation ("Positive" or "Negative"). |
Criteria_Met |
List of specific criteria satisfied. |
Calculated_Ratio |
The calculated ST/S ratio. |
References
Smith SW, Dodd KW, Henry TD, Dvorak DM, Pearce LA. Diagnosis of ST-elevation myocardial infarction in the presence of left bundle branch block with the ST-elevation to S-wave ratio in a modified Sgarbossa rule. Ann Emerg Med. 2012;60(6):766-776. doi:10.1016/j.annemergmed.2012.07.119
Examples
# Example 1: Positive (Concordant STE)
# STE Conc 2mm, STD V1-V3 0, STE Disc 0, S-wave 10
modified_sgarbossa_criteria(2, 0, 0, 10)
# Example 2: Positive (Modified Ratio)
# STE Conc 0, STD 0, STE Disc 4mm, S-wave 10mm (Ratio 0.4)
modified_sgarbossa_criteria(0, 0, 4, 10)
# Example 3: Negative
# STE Conc 0, STD 0, STE Disc 2mm, S-wave 20mm (Ratio 0.1)
modified_sgarbossa_criteria(0, 0, 2, 20)
Modified SOAR Score for Stroke
Description
Calculates the Modified SOAR (mSOAR) Score to predict short-term (inpatient) mortality in patients with acute stroke. The score incorporates Stroke type, Oxfordshire Community Stroke Project (OCSP) classification, Age, pre-stroke modified Rankin Scale (mRS), and admission NIHSS score.
Usage
modified_soar_stroke_score(stroke_type, ocsp_classification, age, pre_stroke_mrs,
nihss_score)
Arguments
stroke_type |
String. Type of stroke: "infarct" (0 pts) or "hemorrhage" (1 pt). |
ocsp_classification |
String. Oxfordshire Community Stroke Project classification. "lacs": Lacunar syndrome (0 pts). "pacs": Partial anterior circulation syndrome (0 pts). "pocs": Posterior circulation syndrome (1 pt). "tacs": Total anterior circulation syndrome (2 pts). |
age |
Numeric. Patient age in years. <= 65: 0 pts. 66-85: 1 pt. > 85: 2 pts. |
pre_stroke_mrs |
Numeric. Pre-stroke Modified Rankin Scale score (0-5). 0-2: 0 pts. 3-4: 1 pt. 5: 2 pts. |
nihss_score |
Numeric. Admission NIH Stroke Scale score. 0-4: 0 pts. 5-10: 1 pt. >= 11: 2 pts. |
Value
A list containing:
mSOAR_Score |
The calculated score (Range 0-9). |
Est_Inpatient_Mortality |
Estimated probability of inpatient mortality based on derivation cohorts. |
References
Myint PK, Clark AB, Kwok CS, et al. The SOAR (Stroke subtype, Oxfordshire Community Stroke Project classification, Age, pre-stroke modified Rankin) score in predicting early mortality post-stroke. Top Stroke Rehabil. 2014;21(1):34-41. Abdul-Rahim AH, Quinn TJ, Alder S, et al. Derivation and Validation of a Novel Prognostic Scale (Modified-SOAR) to Predict Early Mortality in Acute Stroke. Stroke. 2016;47(3):742-747. doi:10.1161/STROKEAHA.115.011630
Examples
# Example 1: Low Risk
# Infarct (0), LACS (0), 60yo (0), mRS 0 (0), NIHSS 3 (0)
# Score = 0
modified_soar_stroke_score("infarct", "lacs", 60, 0, 3)
# Example 2: High Risk
# Hemorrhage (1), TACS (2), 87yo (2), mRS 4 (1), NIHSS 15 (2)
# Score = 8
modified_soar_stroke_score("hemorrhage", "tacs", 87, 4, 15)
Modified Sequential Organ Failure Assessment (mSOFA) Score
Description
Calculates the Modified SOFA (mSOFA) score, which replaces the PaO2/FiO2 ratio used in the standard SOFA score with the SpO2/FiO2 ratio. This allows for organ failure assessment without requiring arterial blood gas analysis.
Usage
modified_sofa_score(spo2_percent, fio2_percent, platelet_count, bilirubin_mg_dl,
hypotension_level, gcs_score, creatinine_mg_dl)
Arguments
spo2_percent |
Numeric. Oxygen saturation percentage (0-100). |
fio2_percent |
Numeric. Fraction of inspired oxygen (e.g., 21 for Room Air, 100 for 100%). Can be entered as percent (21-100) or fraction (0.21-1.0). |
platelet_count |
Numeric. Platelet count in x10^3/uL. |
bilirubin_mg_dl |
Numeric. Total Bilirubin in mg/dL. |
hypotension_level |
Numeric (0-4). Cardiovascular score based on MAP and vasopressor support: 0: MAP >= 70 mmHg. 1: MAP < 70 mmHg. 2: Dopamine <= 5 mcg/kg/min or Dobutamine (any dose). 3: Dopamine > 5 or Epinephrine <= 0.1 or Norepinephrine <= 0.1. 4: Dopamine > 15 or Epinephrine > 0.1 or Norepinephrine > 0.1. |
gcs_score |
Numeric. Glasgow Coma Scale score (3-15). |
creatinine_mg_dl |
Numeric. Serum Creatinine in mg/dL. |
Value
A list containing:
mSOFA_Score |
The calculated total score (Range 0-24). |
Mortality_Estimate |
Approximate mortality risk associated with the score range. |
Subscores |
Individual scores for each organ system. |
References
Grissom CK, Brown SM, Kuttler KG, et al. A modified sequential organ failure assessment score for critical care triage. Disaster Med Public Health Prep. 2010;4(4):277-284. doi:10.1001/dmp.2010.40
Examples
# Example 1: Moderate Severity
# SpO2 92% on 50% FiO2 (S/F=184 -> 3pts), Plt 120 (1pt), Bili 1.0 (0pt),
# MAP<70 (1pt), GCS 14 (1pt), Cr 1.3 (1pt)
modified_sofa_score(92, 50, 120, 1.0, 1, 14, 1.3)
# Example 2: Severe
# SpO2 88% on 100% (S/F=88 -> 4pts), Plt 40 (3pts), Bili 3.0 (2pts),
# Norepi >0.1 (4pts), GCS 9 (3pts), Cr 4.0 (3pts)
modified_sofa_score(88, 100, 40, 3.0, 4, 9, 4.0)
Montreal Classification for Inflammatory Bowel Disease
Description
Generates the Montreal Classification code for Crohn's Disease (CD) or Ulcerative Colitis (UC). For CD, it classifies based on Age at diagnosis (A), Location (L), and Behavior (B). For UC, it classifies based on Extent (E) and Severity (S).
Usage
montreal_ibd_classification(disease_type, age_years = NULL, cd_location = NULL,
cd_behavior = NULL, cd_upper_gi = 0, cd_perianal = 0,
uc_extent = NULL, uc_severity = NULL)
Arguments
disease_type |
String. "crohns" or "uc". |
age_years |
Numeric. Age at diagnosis (Required for Crohn's). A1: <17, A2: 17-40, A3: >40. |
cd_location |
String. Disease location (Crohn's). "ileal" (L1), "colonic" (L2), "ileocolonic" (L3). |
cd_behavior |
String. Disease behavior (Crohn's). "non_stricturing_non_penetrating" (B1), "stricturing" (B2), "penetrating" (B3). |
cd_upper_gi |
Numeric (0 or 1). Involvement of upper GI tract (L4 modifier). (1 = Yes). |
cd_perianal |
Numeric (0 or 1). Perianal disease modifier (p). (1 = Yes). |
uc_extent |
String. Extent of disease (UC). "proctitis" (E1), "left_sided" (E2), "extensive" (E3). |
uc_severity |
String. Disease severity (UC). "remission" (S0), "mild" (S1), "moderate" (S2), "severe" (S3). |
Value
A list containing:
Classification_Code |
The resulting Montreal classification string (e.g., "A2 L1 B1" or "E2 S1"). |
References
Satsangi J, Silverberg MS, Vermeire S, Colombel JF. The Montreal classification of inflammatory bowel disease: controversies, consensus, and implications. Gut. 2006;55(6):749-753. doi:10.1136/gut.2005.082909
Examples
# Example 1: Crohn's Disease
# 25yo, Ileal, Stricturing, No upper/perianal
montreal_ibd_classification("crohns", 25, "ileal", "stricturing", 0, 0)
# Example 2: Crohn's with modifiers
# 16yo, Colonic, Penetrating, Perianal disease present
montreal_ibd_classification("crohns", 16, "colonic", "penetrating", 0, 1)
# Example 3: Ulcerative Colitis
# Left-sided, Moderate severity
montreal_ibd_classification("uc", uc_extent = "left_sided", uc_severity = "moderate")
Medication Regimen Complexity-Intensive Care Unit (MRC-ICU) Score
Description
Calculates the MRC-ICU score, a tool designed to quantify the complexity of medication regimens in critically ill patients. The score is a weighted sum of prescribed medications and supportive therapies (e.g., mechanical ventilation, dialysis). Higher scores are associated with increased mortality, ICU length of stay, and pharmacist workload.
Usage
mrc_icu_score(aminoglycosides = 0, amphotericin_b = 0, antiarrhythmics = 0,
anticoagulants_oral = 0, anticonvulsants = 0, argatroban = 0,
azole_antifungals = 0, blood_products = 0, chemotherapy = 0,
clozapine = 0, digoxin = 0, ganciclovir_valganciclovir = 0,
hyperosmolar_fluids = 0, immunosuppressants = 0,
lidocaine_infusion = 0, lithium = 0, prostacyclins = 0,
theophylline = 0, therapeutic_heparins = 0, vancomycin_iv = 0,
warfarin = 0, thromboembolic_prophylaxis = 0,
stress_ulcer_prophylaxis = 0, glycemic_control = 0,
bowel_regimen = 0, chlorhexidine = 0, inhalers_nebulizers = 0,
continuous_sedation = 0, continuous_vasopressors = 0,
continuous_inotropes = 0, continuous_nmba = 0,
continuous_iv_fluids = 0, parenteral_nutrition = 0,
fluid_bolus = 0, renal_replacement_therapy = 0,
mechanical_ventilation = 0)
Arguments
aminoglycosides |
Numeric. Number of aminoglycoside orders (e.g., Amikacin, Gentamicin). Weighted 3 points each. |
amphotericin_b |
Numeric. Number of Amphotericin B orders. Weighted 1 point. |
antiarrhythmics |
Numeric. Number of antiarrhythmic orders (e.g., Amiodarone, Sotalol). Weighted 1 point. |
anticoagulants_oral |
Numeric. Number of oral anticoagulant orders (DOACs, Fondaparinux). Weighted 1 point. |
anticonvulsants |
Numeric. Number of anticonvulsant orders (e.g., Phenytoin, Levetiracetam). Weighted 3 points. |
argatroban |
Numeric. Number of Argatroban orders. Weighted 2 points. |
azole_antifungals |
Numeric. Number of Azole antifungal orders (e.g., Voriconazole). Weighted 2 points. |
blood_products |
Numeric. Number of blood product orders (Factors, ATIII). Weighted 2 points. |
chemotherapy |
Numeric. Number of active chemotherapy orders. Weighted 3 points. |
clozapine |
Numeric. Number of Clozapine orders. Weighted 3 points. |
digoxin |
Numeric. Number of Digoxin orders. Weighted 3 points. |
ganciclovir_valganciclovir |
Numeric. Number of Ganciclovir/Valganciclovir orders. Weighted 1 point. |
hyperosmolar_fluids |
Numeric. Number of hyperosmolar fluid orders (Mannitol, Hypertonic Saline). Weighted 1 point. |
immunosuppressants |
Numeric. Number of immunosuppressant orders (e.g., Tacrolimus, Cyclosporine). Weighted 3 points. |
lidocaine_infusion |
Numeric. Number of Lidocaine infusion orders. Weighted 2 points. |
lithium |
Numeric. Number of Lithium orders. Weighted 3 points. |
prostacyclins |
Numeric. Number of Prostacyclin orders (e.g., Epoprostenol). Weighted 2 points. |
theophylline |
Numeric. Number of Theophylline orders. Weighted 3 points. |
therapeutic_heparins |
Numeric. Number of therapeutic heparin/enoxaparin orders. Weighted 2 points. |
vancomycin_iv |
Numeric. Number of IV Vancomycin orders. Weighted 3 points. |
warfarin |
Numeric. Number of Warfarin orders. Weighted 3 points. |
thromboembolic_prophylaxis |
Numeric (0 or 1). Presence of VTE prophylaxis. Weighted 1 point. |
stress_ulcer_prophylaxis |
Numeric (0 or 1). Presence of stress ulcer prophylaxis. Weighted 1 point. |
glycemic_control |
Numeric (0 or 1). Presence of glycemic control regimen (insulin). Weighted 1 point. |
bowel_regimen |
Numeric (0 or 1). Presence of bowel regimen. Weighted 1 point. |
chlorhexidine |
Numeric (0 or 1). Use of Chlorhexidine. Weighted 1 point. |
inhalers_nebulizers |
Numeric (0 or 1). Use of inhalers or nebulizers. Weighted 1 point. |
continuous_sedation |
Numeric (0 or 1). Continuous sedation infusion. Weighted 2 points. |
continuous_vasopressors |
Numeric. Number of continuous vasopressor infusions. Weighted 3 points each. |
continuous_inotropes |
Numeric. Number of continuous inotrope infusions. Weighted 3 points each. |
continuous_nmba |
Numeric. Number of continuous NMBA infusions. Weighted 3 points each. |
continuous_iv_fluids |
Numeric (0 or 1). Continuous IV fluids. Weighted 1 point. |
parenteral_nutrition |
Numeric (0 or 1). TPN/PPN use. Weighted 3 points. |
fluid_bolus |
Numeric (0 or 1). Fluid bolus administration. Weighted 1 point. |
renal_replacement_therapy |
Numeric (0 or 1). RRT/Dialysis. Weighted 3 points. |
mechanical_ventilation |
Numeric (0 or 1). Mechanical ventilation. Weighted 3 points. |
Value
A list containing:
MRC_ICU_Score |
The total calculated score. |
Interpretation |
Context regarding score implications. |
References
Sikora A, Awdishu L, Palmer H, et al. Validation of the Medication Regimen Complexity-ICU (MRC-ICU) Score.
Examples
# Example 1: High Complexity
# Vancomycin (3), Norepinephrine (3), Vent (3), Sedation (2)
mrc_icu_score(vancomycin_iv = 1, continuous_vasopressors = 1,
mechanical_ventilation = 1, continuous_sedation = 1)
# Example 2: Low Complexity
# Prophylaxis only (VTE 1, Ulcer 1, Bowel 1)
mrc_icu_score(thromboembolic_prophylaxis = 1, stress_ulcer_prophylaxis = 1,
bowel_regimen = 1)
Modified Response Evaluation Criteria in Solid Tumors (mRECIST) for HCC
Description
Evaluates treatment response in Hepatocellular Carcinoma (HCC) using the mRECIST criteria. Unlike standard RECIST, mRECIST focuses on the viable (arterial enhancing) tumor burden rather than total tumor size, providing a better assessment of response to locoregional therapies.
Usage
mrecist_assessment(target_lesions_sum_change, new_lesions_present,
nontarget_lesions_progression, arterial_enhancement_present)
Arguments
target_lesions_sum_change |
Numeric. Percentage change in the sum of diameters of viable (enhancing) target lesions compared to baseline (or nadir for progression). (e.g., -30 for 30% decrease, +20 for 20% increase). |
new_lesions_present |
Numeric (0 or 1). Appearance of new lesions? (1 = Yes). |
nontarget_lesions_progression |
Numeric (0 or 1). Unequivocal progression of non-target lesions? (1 = Yes). |
arterial_enhancement_present |
Numeric (0 or 1). Presence of intratumoral arterial enhancement in target lesions? (1 = Yes). Required to distinguish Complete Response from Partial Response. |
Value
A list containing:
mRECIST_Response |
The calculated response category (CR, PR, SD, PD). |
Description |
Explanation of the criteria met for the classification. |
References
Lencioni R, Llovet JM. Modified RECIST (mRECIST) assessment for hepatocellular carcinoma. Semin Liver Dis. 2010;30(1):52-60. doi:10.1055/s-0030-1247132
Examples
# Example 1: Partial Response
# -40% change, no new lesions, enhancement still present
mrecist_assessment(-40, 0, 0, 1)
# Example 2: Progressive Disease (New Lesion)
# -10% change (stable target), but new lesion present
mrecist_assessment(-10, 1, 0, 1)
Modified Rankin Scale (mRS-9Q) Calculator
Description
Calculates the Modified Rankin Scale (mRS) score using the 9-question (mRS-9Q) logic. This tool determines the degree of disability in stroke patients by asking a hierarchical series of yes/no questions regarding functional independence.
Usage
mrs_9q_score(symptoms_present, able_usual_activities, able_own_affairs,
able_walk_unassisted, able_bodily_needs)
Arguments
symptoms_present |
Numeric (0 or 1). Does the patient have any symptoms? (1 = Yes). |
able_usual_activities |
Numeric (0 or 1). Is the patient able to carry out all usual duties and activities? (1 = Yes). |
able_own_affairs |
Numeric (0 or 1). Is the patient able to look after their own affairs without assistance? (1 = Yes). |
able_walk_unassisted |
Numeric (0 or 1). Is the patient able to walk without assistance? (1 = Yes). |
able_bodily_needs |
Numeric (0 or 1). Is the patient able to attend to their own bodily needs without assistance? (1 = Yes). |
Value
A list containing:
mRS_Score |
The calculated mRS score (Range 0-5). |
Description |
Clinical description of the disability level. |
References
Bruno A, Akinwuntan AE, Lin C, et al. Simplified modified rankin scale questionnaire: reproducibility over the telephone and validation with quality of life. Stroke. 2011;42(8):2276-2279. doi:10.1161/STROKEAHA.111.613273
Examples
# Example 1: Slight Disability (mRS 2)
# Symptoms(1), Can't do usual(0), But handles affairs(1)
mrs_9q_score(1, 0, 1, 1, 1)
# Example 2: Severe Disability (mRS 5)
# Symptoms(1), No activities(0), No affairs(0), No walk(0), No bodily care(0)
mrs_9q_score(1, 0, 0, 0, 0)
MSKCC Additional Nodal Metastasis Nomogram
Description
Calculates the probability of having additional non-sentinel lymph node (NSLN) metastases in breast cancer patients who have a positive sentinel lymph node (SLN). This function implements the logistic regression model from the Memorial Sloan Kettering Cancer Center (MSKCC) nomogram developed by Van Zee et al. It uses pathologic variables to predict the likelihood of residual disease in the axilla.
Usage
mskcc_additional_nodal_metastasis(frozen_section_pos, method_detection,
tumor_size_cm, lvi, multifocality,
num_pos_sln, num_neg_sln)
Arguments
frozen_section_pos |
Numeric (0 or 1). Was the sentinel node metastasis identified on intraoperative frozen section? (1 = Yes, 0 = No). |
method_detection |
String. Method of detection if frozen section was negative or not done. "routine": Routine H&E staining (associated with higher risk than specialized detection). "serial": Serial H&E or Immunohistochemistry (IHC). |
tumor_size_cm |
Numeric. Pathologic tumor size in centimeters. |
lvi |
Numeric (0 or 1). Lymphovascular Invasion present? (1 = Yes, 0 = No). |
multifocality |
Numeric (0 or 1). Multifocality present? (1 = Yes, 0 = No). |
num_pos_sln |
Numeric. Number of positive sentinel lymph nodes found. |
num_neg_sln |
Numeric. Number of negative sentinel lymph nodes found. |
Value
A list containing:
Probability_Non_SLN_Metastasis |
The estimated percentage probability of finding additional metastasis in the non-sentinel nodes. |
Inputs |
A list of the processed input variables. |
References
Van Zee KJ, Manasseh DM, Bevilacqua JL, et al. A nomogram for predicting the likelihood of additional nodal metastases in breast cancer patients with a positive sentinel node biopsy. Ann Surg Oncol. 2003;10(10):1140-1151. doi:10.1245/aso.2003.03.015
Examples
# Example 1: High Risk
# Frozen section positive, 2.5cm tumor, LVI positive, 2 Pos SLN, 0 Neg SLN
mskcc_additional_nodal_metastasis(1, "n/a", 2.5, 1, 0, 2, 0)
# Example 2: Low Risk
# Routine H&E, 1.2cm tumor, No LVI, 1 Pos SLN, 3 Neg SLN
mskcc_additional_nodal_metastasis(0, "routine", 1.2, 0, 0, 1, 3)
MSKCC Risk of Recurrence for GIST
Description
Calculates the likelihood of recurrence-free survival (RFS) at 2 and 5 years after complete surgical resection of a localized primary Gastrointestinal Stromal Tumor (GIST). This nomogram (Goldjsher et al.) uses tumor size, location, and mitotic index.
Usage
mskcc_gist_recurrence_risk(tumor_size_cm, tumor_site, mitotic_index_ge_5)
Arguments
tumor_size_cm |
Numeric. Largest diameter of the tumor in centimeters. |
tumor_site |
String. Location of the tumor. Options: "stomach", "small_intestine", "colon_rectum", "other". |
mitotic_index_ge_5 |
Numeric (0 or 1). Mitotic index >= 5 per 50 High Power Fields (HPF). (1 = Yes). |
Value
A list containing:
Recurrence_Free_Survival_2yr |
Estimated percentage of patients recurrence-free at 2 years. |
Recurrence_Free_Survival_5yr |
Estimated percentage of patients recurrence-free at 5 years. |
Risk_of_Recurrence_2yr |
Estimated percentage risk of recurrence within 2 years. |
Risk_of_Recurrence_5yr |
Estimated percentage risk of recurrence within 5 years. |
References
Goldjsher D, Joanis V, DeMatteo RP, et al. Development and validation of a prognostic nomogram for recurrence-free survival after complete surgical resection of localized, primary gastrointestinal stromal tumor: a retrospective analysis. Lancet Oncol. 2009;10(11):1045-1052. doi:10.1016/S1470-2045(09)70242-6
Examples
# Example 1: Low Risk
# 3cm Stomach GIST, Low Mitosis
mskcc_gist_recurrence_risk(3, "stomach", 0)
# Example 2: High Risk
# 12cm Small Bowel GIST, High Mitosis
mskcc_gist_recurrence_risk(12, "small_intestine", 1)
MSKCC/Motzer Score for Metastatic Renal Cell Carcinoma
Description
Calculates the MSKCC (Motzer) Score for predicting survival in patients with metastatic Renal Cell Carcinoma (RCC) treated with systemic therapy (historically cytokines, now relevant for tyrosine kinase inhibitors and immunotherapy benchmarking). The score stratifies patients into Favorable, Intermediate, or Poor risk groups based on 5 clinical risk factors.
Usage
mskcc_motzer_score(time_to_systemic_tx_lt_1yr, karnofsky_performance_status_lt_80,
serum_calcium_gt_10_mg_dl, hemoglobin_lt_lln, ldh_gt_1_5_uln)
Arguments
time_to_systemic_tx_lt_1yr |
Numeric (0 or 1). Time from initial diagnosis to start of systemic therapy < 1 year. (1 = Yes). |
karnofsky_performance_status_lt_80 |
Numeric (0 or 1). Karnofsky Performance Status < 80%. (1 = Yes). |
serum_calcium_gt_10_mg_dl |
Numeric (0 or 1). Serum Calcium > 10 mg/dL (>2.5 mmol/L). (1 = Yes). |
hemoglobin_lt_lln |
Numeric (0 or 1). Hemoglobin less than the lower limit of normal. (1 = Yes). |
ldh_gt_1_5_uln |
Numeric (0 or 1). Lactate Dehydrogenase > 1.5 times the Upper Limit of Normal. (1 = Yes). |
Value
A list containing:
MSKCC_Motzer_Score |
The calculated risk score (0-5). |
Risk_Group |
Classification (Favorable: 0, Intermediate: 1-2, Poor: >=3). |
Median_Overall_Survival |
Estimated median overall survival based on the original validation cohort. |
References
Motzer RJ, Bacik J, Murphy BA, Russo P, Mazumdar M. Interferon-alfa as a comparative treatment for clinical trials of new therapies against advanced renal-cell carcinoma. J Clin Oncol. 2002;20(1):289-296. doi:10.1200/JCO.2002.20.1.289
Examples
# Example 1: Poor Risk
# <1yr to tx (1), Low KPS (1), High LDH (1)
# Score = 3
mskcc_motzer_score(1, 1, 0, 0, 1)
# Example 2: Favorable Risk
# No risk factors present
# Score = 0
mskcc_motzer_score(0, 0, 0, 0, 0)
Migraine Treatment Optimization Questionnaire (mTOQ-4)
Description
Calculates the mTOQ-4 score to assess the adequacy of acute migraine treatment. The 4-item questionnaire evaluates treatment efficacy (pain-free at 2 hours, function restoration), tolerability (comfortable with side effects), and consistency (sustained relief with single dose). Higher scores indicate better treatment optimization.
Usage
mtoq_4_score(q1_pain_free_2h, q2_function_2h, q3_comfortable_2h, q4_single_dose)
Arguments
q1_pain_free_2h |
Numeric (0-4). Are you pain-free at 2 hours? (0=Never, 4=All the time). |
q2_function_2h |
Numeric (0-4). Does your medicine return you to normal function at 2 hours? (0=Never, 4=All the time). |
q3_comfortable_2h |
Numeric (0-4). Are you comfortable with your medicine's side effects? (0=Never, 4=All the time). |
q4_single_dose |
Numeric (0-4). Does one dose work for 24 hours? (0=Never, 4=All the time). |
Details
Scoring Key: 0 = Never 1 = Rarely 2 = Less than half the time 3 = More than half the time 4 = All the time
Value
A list containing:
mTOQ_4_Score |
The calculated total score (Range 0-16). |
Optimization_Status |
Interpretation of treatment optimization. |
References
Lipton RB, Kolodner K, Bigal ME, et al. Validity and reliability of the Migraine-Treatment Optimization Questionnaire. Cephalalgia. 2009;29(7):751-759. doi:10.1111/j.1468-2982.2008.01785.x
Examples
# Example 1: Optimal Treatment
# All the time (4) for all questions
mtoq_4_score(4, 4, 4, 4)
# Example 2: Poor Optimization
# Rarely (1) for efficacy, sometimes (2) for others
mtoq_4_score(1, 1, 2, 2)
MuLBSTA Score for Viral Pneumonia Mortality
Description
Calculates the MuLBSTA score to predict 90-day mortality in patients with viral pneumonia. The score uses six clinical and laboratory variables: Multilobular infiltration, Lymphocytes, Bacterial coinfection, Smoking history, hypertension, and Age.
Usage
mulbsta_score(multilobular_infiltration, lymphocyte_count, bacterial_coinfection,
smoking_history, hypertension_history, age)
Arguments
multilobular_infiltration |
Numeric (0 or 1). Presence of multilobular infiltrates on chest imaging. (1 = Yes, +5 points). |
lymphocyte_count |
Numeric. Absolute lymphocyte count in x10^9/L. (<= 0.8 x 10^9/L adds +4 points). |
bacterial_coinfection |
Numeric (0 or 1). Presence of bacterial co-infection. (1 = Yes, +4 points). |
smoking_history |
Numeric (0 or 1). History of smoking (current or former). (1 = Yes, +3 points). |
hypertension_history |
Numeric (0 or 1). History of hypertension. (1 = Yes, +2 points). |
age |
Numeric. Patient age in years. (>= 60 years adds +2 points). |
Value
A list containing:
MuLBSTA_Score |
The calculated total score (Range 0-20). |
Risk_Category |
Classification (Low Risk <= 11, High Risk >= 12). |
Mortality_Risk_90_Day |
Estimated 90-day mortality risk. |
References
Guo L, Wei D, Zhang X, et al. Clinical Features Predicting Mortality Risk in Patients With Viral Pneumonia: The MuLBSTA Score. Front Microbiol. 2019;10:2752. doi:10.3389/fmicb.2019.02752
Examples
# Example 1: High Risk
# Multilobular (+5), Lymphocytes 0.5 (+4), Age 65 (+2), Smoker (+3)
# Score = 14
mulbsta_score(1, 0.5, 0, 1, 0, 65)
# Example 2: Low Risk
# Unilobular (0), Lymphocytes 1.5 (0), No bacteria, No smoker, HTN (+2), Age 50
# Score = 2
mulbsta_score(0, 1.5, 0, 0, 1, 50)
IMWG Diagnostic Criteria for Multiple Myeloma
Description
Evaluates patient data against the International Myeloma Working Group (IMWG) criteria to diagnose Active Multiple Myeloma, Smoldering Multiple Myeloma, or MGUS. Diagnosis of Active MM requires the presence of >=10% clonal bone marrow plasma cells (or biopsy-proven plasmacytoma) plus at least one myeloma-defining event (CRAB feature or SLiM biomarker).
Usage
multiple_myeloma_diagnosis(bmpc_percent, plasmacytoma, calcium_elevated,
renal_insufficiency, anemia, bone_lesions,
flc_ratio_gt_100, mri_focal_lesions_gt_1,
m_protein_g_dl = 0)
Arguments
bmpc_percent |
Numeric. Clonal bone marrow plasma cell percentage. |
plasmacytoma |
Numeric (0 or 1). Biopsy-proven bony or extramedullary plasmacytoma. (1 = Yes). |
calcium_elevated |
Numeric (0 or 1). Serum calcium > 1 mg/dL above upper limit of normal or > 11 mg/dL. (1 = Yes). |
renal_insufficiency |
Numeric (0 or 1). Renal insufficiency (Creatinine > 2 mg/dL or CrCl < 40 mL/min). (1 = Yes). |
anemia |
Numeric (0 or 1). Hemoglobin > 2 g/dL below lower limit of normal or < 10 g/dL. (1 = Yes). |
bone_lesions |
Numeric (0 or 1). One or more osteolytic bone lesions on skeletal radiography, CT, or PET-CT. (1 = Yes). |
flc_ratio_gt_100 |
Numeric (0 or 1). Involved:Uninvolved serum free light chain ratio >= 100 (with involved FLC >= 100 mg/L). (1 = Yes). |
mri_focal_lesions_gt_1 |
Numeric (0 or 1). >1 focal lesions on MRI (at least 5mm in size). (1 = Yes). |
m_protein_g_dl |
Numeric (Optional). Serum M-protein level in g/dL. Used to distinguish Smoldering MM from MGUS if BMPC is <10%. |
Value
A list containing:
Diagnosis |
The resulting diagnosis (Active MM, Smoldering MM, or MGUS). |
Criteria_Met |
Summary of which major criteria categories (CRAB, SLiM) were satisfied. |
References
Rajkumar SV, Dimopoulos MA, Palumbo A, et al. International Myeloma Working Group updated criteria for the diagnosis of multiple myeloma. Lancet Oncol. 2014;15(12):e538-e548. doi:10.1016/S1470-2045(14)70442-5
Examples
# Example 1: Active MM (CRAB feature)
# 15% BMPC, Anemia present
multiple_myeloma_diagnosis(15, 0, 0, 0, 1, 0, 0, 0)
# Example 2: Active MM (SLiM feature)
# 20% BMPC, No CRAB, but FLC Ratio > 100
multiple_myeloma_diagnosis(20, 0, 0, 0, 0, 0, 1, 0)
# Example 3: Smoldering MM
# 20% BMPC, No CRAB, No SLiM
multiple_myeloma_diagnosis(20, 0, 0, 0, 0, 0, 0, 0)
IMWG Multiple Myeloma Response Criteria
Description
Evaluates the response to treatment in patients with Multiple Myeloma according to the International Myeloma Working Group (IMWG) uniform response criteria. Classification ranges from Progressive Disease (PD) to Stringent Complete Response (sCR) based on changes in M-protein (serum/urine), FLC levels, bone marrow plasma cells, and imaging findings relative to baseline or nadir.
Usage
multiple_myeloma_response_criteria(serum_m_baseline, serum_m_nadir, serum_m_current,
urine_m_baseline, urine_m_nadir, urine_m_current,
flc_diff_baseline, flc_diff_nadir, flc_diff_current,
bone_marrow_pct, immunofixation_status, flc_ratio,
plasmacytoma_status, bone_lesions_new_increased,
hypercalcemia_present)
Arguments
serum_m_baseline |
Numeric. Baseline Serum M-protein (g/dL). |
serum_m_nadir |
Numeric. Lowest recorded Serum M-protein (g/dL). Used for PD assessment. |
serum_m_current |
Numeric. Current Serum M-protein (g/dL). |
urine_m_baseline |
Numeric. Baseline Urine M-protein (mg/24h). |
urine_m_nadir |
Numeric. Lowest recorded Urine M-protein (mg/24h). |
urine_m_current |
Numeric. Current Urine M-protein (mg/24h). |
flc_diff_baseline |
Numeric. Baseline difference between involved and uninvolved FLC (mg/dL). |
flc_diff_nadir |
Numeric. Lowest recorded FLC difference (mg/dL). |
flc_diff_current |
Numeric. Current FLC difference (mg/dL). |
bone_marrow_pct |
Numeric. Current percentage of bone marrow plasma cells. |
immunofixation_status |
String. Result of serum/urine immunofixation. Options: "positive", "negative". |
flc_ratio |
Numeric. Current Kappa/Lambda FLC ratio. (Normal range approx 0.26-1.65 used for sCR). |
plasmacytoma_status |
String. Status of soft tissue plasmacytomas. Options: "none", "stable", "decreased_50" (>=50% decrease), "disappeared", "increased", "new". |
bone_lesions_new_increased |
Numeric (0 or 1). Development of new or increased size of lytic bone lesions. (1 = Yes). |
hypercalcemia_present |
Numeric (0 or 1). Development of hypercalcemia (>11.5 mg/dL) attributable to plasma cell proliferative disorder. (1 = Yes). |
Value
A list containing:
Response_Category |
The determined response status (sCR, CR, VGPR, PR, SD, or PD). |
Inputs |
Structured list of input values used for calculation. |
References
Kumar S, Paiva B, Anderson KC, et al. International Myeloma Working Group consensus criteria for response and minimal residual disease assessment in multiple myeloma. Lancet Oncol. 2016;17(8):e328-e346. doi:10.1016/S1470-2045(16)30206-6
Examples
# Example 1: Partial Response
# Baseline M=4.0, Current M=1.5 (Reduc >50%), IFE Positive
multiple_myeloma_response_criteria(4.0, 1.0, 1.5, 0, 0, 0, 0, 0,
0, 8, "positive", 2.0, "none", 0, 0)
# Example 2: Progressive Disease
# Nadir M=1.0, Current M=2.0 (Increase >0.5g/dL and >25%)
multiple_myeloma_response_criteria(4.0, 1.0, 2.0, 0, 0, 0, 0, 0,
0, 10, "positive", 2.0, "none", 0, 0)
Mumtaz Score for Readmission in Cirrhosis
Description
Calculates the Mumtaz Score to predict the 30-day readmission risk in patients with decompensated cirrhosis. The score uses variables from the index admission, including demographics, comorbidities (Elixhauser), etiology, complications (ascites, HE, variceal bleed), procedures (paracentesis, dialysis), and discharge disposition.
Usage
mumtaz_cirrhosis_readmission_score(age, primary_payer, elixhauser_comorbidity_score,
non_alcoholic_etiology, ascites_present,
hepatic_encephalopathy_present,
variceal_bleeding_present, hcc_present,
paracentesis_performed, hemodialysis_performed,
disposition)
Arguments
age |
Numeric. Patient age in years. (18-39: +7, 40-64: +4, >=65: 0). |
primary_payer |
String. "medicare" (+4), "medicaid" (+5), "private" (0), "self_pay" (-3), "no_charge_other" (-1). |
elixhauser_comorbidity_score |
Numeric. Elixhauser Comorbidity Index score. (>=3: +2, <3: 0). |
non_alcoholic_etiology |
Numeric (0 or 1). Is the cirrhosis etiology non-alcoholic? (1 = Yes, +2 pts). |
ascites_present |
Numeric (0 or 1). Presence of ascites. (1 = Yes, +5 pts). |
hepatic_encephalopathy_present |
Numeric (0 or 1). Presence of hepatic encephalopathy. (1 = Yes, +4 pts). |
variceal_bleeding_present |
Numeric (0 or 1). Presence of variceal bleeding. (1 = Yes, -7 pts). |
hcc_present |
Numeric (0 or 1). Presence of Hepatocellular Carcinoma. (1 = Yes, +3 pts). |
paracentesis_performed |
Numeric (0 or 1). Paracentesis performed during admission. (1 = Yes, +4 pts). |
hemodialysis_performed |
Numeric (0 or 1). Hemodialysis performed during admission. (1 = Yes, +7 pts). |
disposition |
String. Discharge disposition. "routine" (0), "transfer" (-1), "home_health" (+3), "ama" (+10). |
Value
A list containing:
Mumtaz_Score |
The calculated risk score. |
Risk_Category |
Risk classification (Low, Medium, High). |
Est_30_Day_Readmission_Risk |
Estimated probability of readmission within 30 days. |
References
Mumtaz K, Issak A, Porter K, et al. Validation of Risk Score in Predicting Early Readmissions in Decompensated Cirrhotic Patients: A Model Based on the Administrative Database. Hepatology. 2019;70(2):630-639. doi:10.1002/hep.30618
Examples
# Example 1: High Risk
# 45yo (+4), Medicaid (+5), Ascites (+5), HE (+4), Paracentesis (+4)
# Score = 22
mumtaz_cirrhosis_readmission_score(45, "medicaid", 0, 0, 1, 1, 0, 0, 1, 0, "routine")
# Example 2: Low Risk
# 70yo (0), Private (0), Variceal Bleed (-7), No other factors
# Score = -7
mumtaz_cirrhosis_readmission_score(70, "private", 0, 0, 0, 0, 1, 0, 0, 0, "routine")
Murray Score for Acute Lung Injury
Description
Calculates the Murray Lung Injury Score (LIS) to assess the severity of Acute Respiratory Distress Syndrome (ARDS). The score averages four components: Hypoxemia (PaO2/FiO2), PEEP, Respiratory Compliance, and Chest X-ray infiltration.
Usage
murray_lung_injury_score(pao2_fio2_ratio, peep, respiratory_compliance,
cxr_quadrants)
Arguments
pao2_fio2_ratio |
Numeric. Ratio of arterial oxygen partial pressure to fractional inspired oxygen (PaO2/FiO2). >=300: 0 pts. 225-299: 1 pt. 175-224: 2 pts. 100-174: 3 pts. <100: 4 pts. |
peep |
Numeric. Positive End-Expiratory Pressure (cmH2O). <=5: 0 pts. 6-8: 1 pt. 9-11: 2 pts. 12-14: 3 pts. >=15: 4 pts. |
respiratory_compliance |
Numeric. Respiratory system compliance (mL/cmH2O). Typically calculated as Tidal Volume / (Plateau Pressure - PEEP). >=80: 0 pts. 60-79: 1 pt. 40-59: 2 pts. 20-39: 3 pts. <=19: 4 pts. |
cxr_quadrants |
Numeric (0-4). Number of quadrants showing alveolar consolidation on Chest X-ray. 0: 0 pts. 1: 1 pt. 2: 2 pts. 3: 3 pts. 4: 4 pts. |
Value
A list containing:
Murray_Score |
The calculated Lung Injury Score (average of the 4 components, Range 0-4). |
Severity_Assessment |
Interpretation (No Injury = 0, Mild-Moderate 0.1-2.5, Severe > 2.5). |
Subscores |
Individual points assigned to each component. |
References
Murray JF, Matthay MA, Luce JM, Flick MR. An expanded definition of the adult respiratory distress syndrome. Am Rev Respir Dis. 1988;138(3):720-723. doi:10.1164/ajrccm/138.3.720
Examples
# Example 1: Severe ARDS
# PF 80 (4 pts), PEEP 16 (4 pts), Compliance 18 (4 pts), CXR 4 quads (4 pts)
# Average = 16 / 4 = 4
murray_lung_injury_score(80, 16, 18, 4)
# Example 2: Mild Injury
# PF 250 (1 pt), PEEP 8 (1 pt), Compliance 50 (2 pts), CXR 1 quad (1 pt)
# Average = 5 / 4 = 1.25
murray_lung_injury_score(250, 8, 50, 1)
Malnutrition Universal Screening Tool (MUST)
Description
Calculates the MUST score to identify adults who are malnourished, at risk of malnutrition (undernutrition), or obese. It also includes management guidelines which can be used to develop a care plan.
Usage
must_screening_tool(bmi, weight_loss_percent, acute_disease_effect)
Arguments
bmi |
Numeric. Body Mass Index (kg/m^2). >20.0: 0 pts. 18.5-20.0: 1 pt. <18.5: 2 pts. |
weight_loss_percent |
Numeric. Unplanned weight loss in the past 3-6 months (percent). <5%: 0 pts. 5-10%: 1 pt. >10%: 2 pts. |
acute_disease_effect |
Numeric (0 or 1). Is the patient acutely ill and there has been or is likely to be no nutritional intake for >5 days? (1 = Yes, +2 pts). |
Value
A list containing:
MUST_Score |
The calculated total score (Range 0-6). |
Risk_Category |
Classification (Low Risk: 0, Medium Risk: 1, High Risk: >=2). |
Management_Guideline |
General management recommendations based on the risk category. |
References
Stratton RJ, Hackston A, Longmore D, et al. Malnutrition in hospital outpatients and inpatients: prevalence, concurrent validity and ease of use of the 'malnutrition universal screening tool' ('MUST') for adults. Br J Nutr. 2004;92(5):799-808. doi:10.1079/bjn20041258
Examples
# Example 1: High Risk
# BMI 17 (+2), No weight loss (0), No acute illness (0)
# Score = 2
must_screening_tool(17, 0, 0)
# Example 2: Medium Risk
# BMI 22 (0), 7% weight loss (+1), No acute illness (0)
# Score = 1
must_screening_tool(22, 7, 0)
MYSEC-PM Score for Secondary Myelofibrosis
Description
Calculates the MYSEC-PM (Myelofibrosis Secondary to PV and ET-Prognostic Model) score. This tool is specifically designed to predict overall survival in patients with myelofibrosis that has evolved from Polycythemia Vera (PV) or Essential Thrombocythemia (ET), known as secondary myelofibrosis. It stratifies patients into four risk categories.
Usage
mysec_pm_score(age, hemoglobin_g_dl, platelet_count, circulating_blasts_percent,
calr_unmutated, constitutional_symptoms)
Arguments
age |
Numeric. Patient age in years. |
hemoglobin_g_dl |
Numeric. Hemoglobin level in g/dL. (< 11 g/dL adds points). |
platelet_count |
Numeric. Platelet count in x10^9/L. (< 150 x 10^9/L adds points). |
circulating_blasts_percent |
Numeric. Percentage of circulating blasts in peripheral blood. (>= 3% adds points). |
calr_unmutated |
Numeric (0 or 1). Is the CALR genotype unmutated? (1 = Yes). Note: Patients with JAK2 or MPL mutations, or "Triple Negative" status, are considered CALR unmutated for this score. Only confirmed CALR mutations are 0. |
constitutional_symptoms |
Numeric (0 or 1). Presence of constitutional symptoms (weight loss >10% in 6 months, unexplained fever, or excessive sweating). (1 = Yes). |
Value
A list containing:
MYSEC_PM_Score |
The calculated prognostic score. |
Risk_Category |
Classification (Low < 11, Intermediate-1 11-14, Intermediate-2 14-16, High >= 16). |
Median_Overall_Survival |
Estimated median survival time. |
References
Passamonti F, Giorgino T, Mora B, et al. A clinical-molecular prognostic model to predict survival in patients with post polycythemia vera and post essential thrombocythemia myelofibrosis. Leukemia. 2017;31(12):2726-2731. doi:10.1038/leu.2017.169
Examples
# Example 1: High Risk
# 70yo (16.1 pts), no other factors
# Score = 16.1
mysec_pm_score(70, 12, 200, 1, 0, 0)
# Example 2: Low Risk
# 40yo (9.2 pts), no other factors
# Score = 9.2
mysec_pm_score(40, 12, 200, 0, 0, 0)
Myxedema Coma Diagnostic Score
Description
Calculates the diagnostic score for myxedema coma. This tool aggregates clinical and laboratory findings (thermoregulation, CNS status, GI symptoms, cardiovascular dysfunction, metabolic disturbances, and precipitating events) to assess the likelihood of myxedema coma in patients with severe hypothyroidism.
Usage
myxedema_coma_score(temp_c, cns_status, gi_symptoms, precipitating_event,
bradycardia, ecg_changes, hypotension, hyponatremia,
hypoglycemia, hypoxemia_hypercapnia)
Arguments
temp_c |
Numeric. Body temperature in degrees Celsius. (>35: 0 pts, 32-35: 10 pts, <32: 20 pts). |
cns_status |
String. Central Nervous System status. Options: "absent" (0 pts), "drowsy_lethargic" (10 pts), "obtunded" (15 pts), "stupor_coma" (20 pts). |
gi_symptoms |
String. Gastrointestinal symptoms. Options: "absent" (0 pts), "anorexia_pain_constipation" (5 pts), "decreased_motility_ileus" (10 pts). |
precipitating_event |
Numeric (0 or 1). Presence of a precipitating event (e.g., infection, surgery, drug exposure). (1 = Yes, +10 pts). |
bradycardia |
Numeric (0 or 1). Bradycardia present. (1 = Yes, +10 pts). |
ecg_changes |
Numeric (0 or 1). ECG changes present (e.g., low voltage, prolonged QT, heart block). (1 = Yes, +10 pts). |
hypotension |
Numeric (0 or 1). Hypotension or cardiogenic shock present. (1 = Yes, +10 pts). |
hyponatremia |
Numeric (0 or 1). Hyponatremia present. (1 = Yes, +10 pts). |
hypoglycemia |
Numeric (0 or 1). Hypoglycemia present. (1 = Yes, +10 pts). |
hypoxemia_hypercapnia |
Numeric (0 or 1). Hypoxemia or hypercapnia present. (1 = Yes, +10 pts). |
Value
A list containing:
Diagnostic_Score |
The calculated total score. |
Interpretation |
Diagnostic likelihood (Unlikely <25, Suggestive 25-59, Diagnostic >=60). |
References
Popoveniuc G, Chandra T, Sud A, et al. A diagnostic scoring system for myxedema coma. Endocr Pract. 2014;20(8):808-817. doi:10.4158/EP13303.OR
Examples
# Example 1: Diagnostic (Score 70)
# Temp 30C (20), Coma (20), Ileus (10), Precipitant (10), Bradycardia (10)
myxedema_coma_score(30, "stupor_coma", "decreased_motility_ileus", 1, 1, 0, 0, 0, 0, 0)
# Example 2: Suggestive (Score 30)
# Temp 34C (10), Lethargic (10), Hypoglycemia (10)
myxedema_coma_score(34, "drowsy_lethargic", "absent", 0, 0, 0, 0, 0, 1, 0)
North American Familial Chylomicronemia Score (NAFCS)
Description
Calculates the NAFCS (derived from the Moulin FCS Score) to estimate the likelihood of Familial Chylomicronemia Syndrome (FCS) in patients with severe hypertriglyceridemia. The score assesses clinical history, response to treatment, and the absence of secondary factors to differentiate FCS from Multifactorial Chylomicronemia Syndrome (MCS).
Usage
nafcs_score(fasting_tg_mg_dl, history_pancreatitis, unexplained_abdominal_pain,
secondary_factors_present, age_onset_lt_40, poor_response_treatment,
tg_units = "mg/dL")
Arguments
fasting_tg_mg_dl |
Numeric. Fasting triglyceride level. Note: The score requires a history of at least three consecutive fasting triglyceride levels > 885 mg/dL (10 mmol/L). This input should be the highest recorded level. 10-20 mmol/L (885-1770 mg/dL): +1 point. >20 mmol/L (>1770 mg/dL): +3 points. |
history_pancreatitis |
Numeric (0 or 1). History of pancreatitis. (1 = Yes, +1 point). |
unexplained_abdominal_pain |
Numeric (0 or 1). History of recurrent, unexplained abdominal pain. (1 = Yes, +1 point). |
secondary_factors_present |
Numeric (0 or 1). Presence of secondary factors for hypertriglyceridemia (e.g., BMI > 30, diabetes, alcohol use, pregnancy, specific medications). (0 = No secondary factors present, +2 points; 1 = Secondary factors present, 0 points). |
age_onset_lt_40 |
Numeric (0 or 1). Age at diagnosis of hypertriglyceridemia < 40 years. (1 = Yes, +1 point). |
poor_response_treatment |
Numeric (0 or 1). History of poor response (<20% reduction) to standard lipid-lowering therapy (fibrates/statins). (1 = Yes, +1 point). |
tg_units |
String. Units for triglyceride input. Options: "mg/dL" (default) or "mmol/L". |
Value
A list containing:
NAFCS_Score |
The calculated total score (Range 0-9). |
Interpretation |
Diagnostic likelihood (Unlikely vs. Very Likely). |
References
Moulin P, Dufour R, Averna M, et al. Identification and diagnosis of patients with familial chylomicronemia syndrome (FCS): Expert panel recommendations and proposal of an "FCS score". Atherosclerosis. 2018;275:265-272. doi:10.1016/j.atherosclerosis.2018.06.814 Paquette M, Ahmed Z, Hegele RA, Baass A. The Familial Chylomicronemia Syndrome Score: Validation of a Clinical Tool for the Diagnosis of Familial Chylomicronemia Syndrome. J Clin Lipidol. 2019.
Examples
# Example 1: High Likelihood
# TG 2000 mg/dL (+3), Pancreatitis (+1), No secondary factors (+2),
# Age <40 (+1), Poor response (+1), Pain (0)
# Score = 3 + 1 + 2 + 1 + 1 = 8 (Borderline/High)
nafcs_score(2000, 1, 0, 0, 1, 1)
# Example 2: Low Likelihood
# TG 900 mg/dL (+1), No pancreatitis, Secondary factors (Diabetes) present (0),
# Age >40 (0), Good response (0)
# Score = 1
nafcs_score(900, 0, 0, 1, 0, 0)
NAFLD Activity Score (NAS)
Description
Calculates the NAFLD Activity Score (NAS) to assess the severity of Non-Alcoholic Fatty Liver Disease based on liver biopsy findings. The score sums grades for steatosis, lobular inflammation, and hepatocyte ballooning to help distinguish between Non-Alcoholic Steatohepatitis (NASH) and simple steatosis.
Usage
nafld_activity_score(steatosis_grade, lobular_inflammation, hepatocyte_ballooning)
Arguments
steatosis_grade |
Numeric (0-3). Percentage of hepatocytes containing fat. 0: <5%. 1: 5-33%. 2: >33-66%. 3: >66%. |
lobular_inflammation |
Numeric (0-3). Number of inflammatory foci per 200x field. 0: No foci. 1: < 2 foci. 2: 2-4 foci. 3: > 4 foci. |
hepatocyte_ballooning |
Numeric (0-2). Amount of ballooning degeneration. 0: None. 1: Few balloon cells. 2: Many cells/prominent ballooning. |
Value
A list containing:
NAS_Score |
The calculated total score (Range 0-8). |
Interpretation |
Clinical likelihood of NASH. |
References
Kleiner DE, Brunt EM, Van Natta M, et al. Design and validation of a histological scoring system for nonalcoholic fatty liver disease. Hepatology. 2005;41(6):1313-1321. doi:10.1002/hep.20701
Examples
# Example 1: NASH Likely
# Steatosis >66% (3), Inflammation >4 (3), Ballooning Many (2)
# Score = 8
nafld_activity_score(3, 3, 2)
# Example 2: Borderline
# Steatosis 5-33% (1), Inflammation <2 (1), Ballooning Few (1)
# Score = 3
nafld_activity_score(1, 1, 1)
Non-Alcoholic Fatty Liver Disease (NAFLD) Fibrosis Score
Description
Using SI/non-SI measurements of albumin, and age, bmi, impaired fasting glucose/diabetes, aspartate trasnferase, alanine transferase, and platelet counts, calcualte the level of scarring in the liver from F0-F2 (no-moderate fibrosis) to F3-F4 (severe fibrosis - cirrhosis). Scores below -1.455 are associated with F0-F2 and scores above 0.675 are associated with F3-F4, with inbetween scores being indeterminate. Created by Angulo et al. (2007) and validated by Treeprasertsuk et al. (2013).
Usage
nafld_score(age, bmi, diabetes, ast, alt, platelet, albumin, units = "")
Arguments
age |
Numeric value of age. |
bmi |
Numeric value of bmi (kg/m^2). |
diabetes |
If impaired fasting glucose or type 2 diabetes mellitus is true, 1, if not, 0. |
ast |
Numeric value of aspartate transferase (U/L). |
alt |
Numeric value of alanine transferase (U/L). |
platelet |
Numeric value of platelet count in either 10^9/L or 10^3/uL. |
albumin |
Numeric value of serum albumin in either non-SI (g/dL) or SI (g/L). |
units |
String to specify non-SI units by not including units argument or SI units by including units="SI". |
Value
A numeric value/vector with predicted NAFLD fibrosis score.
References
Angulo P, Hui JM, Marchesini G, Bugianesi E, George J, Farrell GC, Enders F, Saksena S, Burt AD, Bida JP, Lindor K, Sanderson SO, Lenzi M, Adams LA, Kench J, Therneau TM, Day CP. The NAFLD fibrosis score: a noninvasive system that identifies liver fibrosis in patients with NAFLD. Hepatology. 2007 Apr;45(4):846-54. PMID: 17393509. Treeprasertsuk S, Björnsson E, Enders F, Suwanwalaikorn S, Lindor KD. NAFLD fibrosis score: A prognostic predictor for mortality and liver complications among NAFLD patients. World Journal of Gastroenterology. 2013;19(8):1219-1229. doi:10.3748/wjg.v19.i8.1219. Tapper EB, Lok AS. Use of Liver Imaging and Biopsy in Clinical Practice. N Engl J Med. 2017;377(8):756-768.
Examples
# For non-SI measurements, the function is defined as
nafld_score(50, 28, 1, 15, 2, 170, 3.5, units = "")
# For SI measurements, the function is defined as
nafld_score(50, 28, 1, 15, 2, 170, 3.5, units = "SI")
Naloxone Drip Dosing
Description
Calculates the recommended hourly infusion rate for a naloxone drip. This is indicated for patients with opioid intoxication who require repeat bolus doses or have ingested long-acting opioids (e.g., methadone). The standard toxicology rule of thumb is to set the hourly infusion rate at 2/3 of the effective "wake-up" bolus dose.
Usage
naloxone_drip_dosing(wake_up_bolus_mg)
Arguments
wake_up_bolus_mg |
Numeric. The total bolus dose of naloxone (in mg) required to reverse respiratory depression (the "wake-up" dose). |
Value
A list containing:
Calculated_Hourly_Rate_mg_hr |
The calculated continuous infusion rate in mg/hr. |
Protocol_Note |
Guidance on the 2/3 rule. |
References
Goldfrank LR. Goldfrank's Toxicologic Emergencies. 11th ed. New York, NY: McGraw-Hill Education; 2019. Clarke SF, Dargan PI, Jones AL. Naloxone in opioid poisoning: walking the tightrope. Emerg Med J. 2005;22(9):612-616. doi:10.1136/emj.2003.009613
Examples
# Example 1: 0.4 mg reversed the patient
# Rate = 0.4 * (2/3) = 0.27 mg/hr
naloxone_drip_dosing(0.4)
# Example 2: High dose required (2 mg)
# Rate = 2 * (2/3) = 1.33 mg/hr
naloxone_drip_dosing(2.0)
NCCN-IPI for Diffuse Large B-Cell Lymphoma
Description
Calculates the NCCN-IPI score to predict 5-year overall survival in patients with Diffuse Large B-Cell Lymphoma (DLBCL) treated with rituximab-based chemotherapy. This enhanced index refines the original IPI by better stratifying age and LDH levels and identifying specific high-risk extranodal sites.
Usage
nccn_ipi_score(age, ldh_ratio, extranodal_sites_disease, stage,
performance_status)
Arguments
age |
Numeric. Patient age in years. <= 40: 0 pts. 41-60: 1 pt. 61-75: 2 pts. > 75: 3 pts. |
ldh_ratio |
Numeric. Ratio of patient's LDH to the Upper Limit of Normal (ULN). <= 1: 0 pts. > 1-3: 1 pt. > 3: 2 pts. |
extranodal_sites_disease |
String. Presence of disease in specific high-risk extranodal sites (Bone Marrow, CNS, Liver, GI Tract, or Lung). "bone_marrow", "cns", "liver", "gi_tract", "lung": 1 pt. "none_or_other": 0 pts. |
stage |
Numeric. Ann Arbor Stage (1-4). Stage III or IV: 1 pt. Stage I or II: 0 pts. |
performance_status |
Numeric. ECOG Performance Status (0-4). >= 2: 1 pt. < 2: 0 pts. |
Value
A list containing:
NCCN_IPI_Score |
The calculated total score (Range 0-8). |
Risk_Group |
Classification (Low, Low-Intermediate, High-Intermediate, High). |
Est_5_Year_Overall_Survival |
Estimated 5-year overall survival percentage. |
References
Zhou Z, Sehn LH, Rademaker AW, et al. An enhanced International Prognostic Index (NCCN-IPI) for patients with diffuse large B-cell lymphoma treated in the rituximab era. Blood. 2014;123(6):837-842. doi:10.1182/blood-2013-09-524108
Examples
# Example 1: High Risk
# Age 80 (+3), LDH 4x (+2), Bone Marrow (+1), Stage IV (+1), ECOG 2 (+1)
# Score = 8
nccn_ipi_score(80, 4.0, "bone_marrow", 4, 2)
# Example 2: Low Risk
# Age 35 (0), Normal LDH (0), No high-risk sites, Stage I (0), ECOG 0 (0)
# Score = 0
nccn_ipi_score(35, 0.8, "none_or_other", 1, 0)
Neck Disability Index (NDI)
Description
Calculates the Neck Disability Index (NDI), a standard instrument for measuring self-rated disability due to neck pain. It consists of 10 items related to daily activities, each scored from 0 to 5. The final score provides a percentage of disability.
Usage
neck_disability_index(pain_intensity, personal_care, lifting, reading,
headaches, concentration, work, driving, sleeping,
recreation)
Arguments
pain_intensity |
Numeric (0-5). 0: No pain; 5: Worst imaginable pain. |
personal_care |
Numeric (0-5). 0: Can look after self normally; 5: Needs help with all personal care. |
lifting |
Numeric (0-5). 0: Can lift heavy weights; 5: Cannot lift or carry anything. |
reading |
Numeric (0-5). 0: Can read as much as wanted; 5: Cannot read at all. |
headaches |
Numeric (0-5). 0: No headaches; 5: Frequent/severe headaches almost all the time. |
concentration |
Numeric (0-5). 0: Can concentrate fully; 5: Cannot concentrate at all. |
work |
Numeric (0-5). 0: Can do as much work as wanted; 5: Cannot do any work. |
driving |
Numeric (0-5). 0: Can drive as long as wanted; 5: Cannot drive at all. |
sleeping |
Numeric (0-5). 0: No trouble sleeping; 5: Sleep is completely disturbed (1-2 hours). |
recreation |
Numeric (0-5). 0: Able to engage in all activities; 5: Cannot do any recreational activities. |
Value
A list containing:
NDI_Score_Raw |
The sum of the section scores (Range 0-50). |
NDI_Percentage |
The raw score converted to a percentage (Score * 2). |
Interpretation |
Clinical severity of disability (None, Mild, Moderate, Severe, Complete). |
References
Vernon H, Mior S. The Neck Disability Index: a study of reliability and validity. J Manipulative Physiol Ther. 1991;14(7):409-415.
Examples
# Example 1: Severe Disability
# Moderate to high scores across all domains
neck_disability_index(3, 2, 4, 3, 3, 2, 4, 3, 2, 3)
# Example 2: Mild Disability
# Minor pain and headache, mostly normal function
neck_disability_index(1, 0, 1, 0, 1, 0, 0, 0, 1, 0)
NEDOCS Score for Emergency Department Overcrowding
Description
Calculates the National Emergency Department Overcrowding Scale (NEDOCS) score. This tool quantifies the degree of overcrowding in an emergency department at a specific point in time using operational variables such as patient volume, bed capacity, and wait times.
Usage
nedocs_score(total_patients_ed, total_ed_beds, admits_in_ed, total_hospital_beds,
ventilated_patients_ed, longest_admit_time_hrs,
wait_time_last_patient_hrs)
Arguments
total_patients_ed |
Numeric. Total number of patients currently in the ED (including those in beds, hallways, and the waiting room). |
total_ed_beds |
Numeric. Total number of licensed ED treatment beds. |
admits_in_ed |
Numeric. Number of patients in the ED admitted to the hospital but waiting for a bed. |
total_hospital_beds |
Numeric. Total number of licensed hospital beds. |
ventilated_patients_ed |
Numeric. Number of patients currently on ventilators in the ED. |
longest_admit_time_hrs |
Numeric. Time (in hours) the longest-waiting admitted patient has been in the ED. |
wait_time_last_patient_hrs |
Numeric. Waiting time (in hours) from arrival to bed placement for the last patient placed in a bed. |
Value
A list containing:
NEDOCS_Score |
The calculated score (Range 0-200). |
Status |
Classification of overcrowding severity (e.g., Not Busy, Overcrowded, Disaster). |
References
Weiss SJ, Derlet R, Arndahl J, et al. Estimating the degree of emergency department overcrowding in academic medical centers: results of the National ED Overcrowding Study (NEDOCS). Acad Emerg Med. 2004;11(1):38-50. doi:10.1197/j.aem.2003.07.017
Examples
# Example 1: Busy ED
# 35 patients, 30 beds, 4 admits, 400 hospital beds, 0 vents, 4h wait admit, 1h last bed
# Score = -20 + 85.8(1.16) + 600(0.01) + 0 + 0.93(4) + 5.64(1) = ~95 (Overcrowded)
nedocs_score(35, 30, 4, 400, 0, 4, 1)
# Example 2: Disaster Level
# 60 patients, 30 beds, 15 admits, 400 hospital beds, 2 vents, 12h wait admit, 3h last bed
# Score = -20 + 85.8(2) + 600(0.0375) + 13.4(2) + 0.93(12) + 5.64(3) = ~229 -> Capped at 200
nedocs_score(60, 30, 15, 400, 2, 12, 3)
Neonatal Early-Onset Sepsis (EOS) Calculator
Description
Calculates the probability of Early-Onset Sepsis (EOS) in newborns (>= 34 weeks gestation) based on maternal risk factors and the infant's clinical presentation. It uses a multivariate risk model (based on the Kaiser Permanente study) to adjust the prior probability derived from maternal factors by the likelihood ratio of the neonatal clinical status.
Usage
neonatal_eos_calculator(gestational_age_weeks, highest_maternal_temp_c,
rom_hours, gbs_status, intrapartum_antibiotics,
neonatal_appearance, baseline_incidence_per_1000 = 0.5)
Arguments
gestational_age_weeks |
Numeric. Gestational age in weeks (must be >= 34). |
highest_maternal_temp_c |
Numeric. Highest maternal antepartum temperature in degrees Celsius. |
rom_hours |
Numeric. Duration of Rupture of Membranes in hours. |
gbs_status |
String. Maternal Group B Streptococcus status. Options: "positive", "negative", "unknown". |
intrapartum_antibiotics |
String. Type and duration of intrapartum antibiotics. Options: "none" (None or <2h before delivery), "specific_lt_2" (GBS Specific < 2h), "specific_2_to_3_9" (GBS Specific 2-3.9h), "specific_ge_4" (GBS Specific >= 4h), "broad_lt_2" (Broad Spectrum < 2h), "broad_2_to_3_9" (Broad Spectrum 2-3.9h), "broad_ge_4" (Broad Spectrum >= 4h). |
neonatal_appearance |
String. Clinical presentation of the neonate. "well_appearing": Normal exam. "equivocal": Abnormal vitals (e.g., tachycardia, tachypnea) but clinically stable. "clinical_illness": Severe respiratory distress, shock, need for mechanical ventilation/pressors. |
baseline_incidence_per_1000 |
Numeric. The local baseline incidence of EOS per 1000 live births (default 0.5). |
Value
A list containing:
EOS_Risk_Per_1000 |
The calculated posterior probability of sepsis per 1000 births. |
Clinical_Presentation |
The input clinical status used for the likelihood ratio adjustment. |
Recommendation |
Management guidance based on the calculated risk and clinical status (Routine care, Enhanced observation, or Antibiotics). |
References
Puopolo KM, Draper D, Wi S, et al. Estimating the probability of neonatal early-onset infection on the basis of maternal risk factors. Pediatrics. 2011;128(5):e1155-1163. Puopolo KM, et al. Management of Neonates Born at >=34 6/7 Weeks' Gestation With Suspected or Proven Early-Onset Bacterial Sepsis. Pediatrics. 2018.
Examples
# Example 1: Well appearing, 40 weeks, GBS neg, PROM 18h, Temp 38.5C
neonatal_eos_calculator(40, 38.5, 18, "negative", "none", "well_appearing")
# Example 2: Equivocal exam, 36 weeks, GBS pos, No Abx
neonatal_eos_calculator(36, 37.0, 12, "positive", "none", "equivocal")
Neonatal Partial Exchange Transfusion for Polycythemia
Description
Calculates the volume of blood to be exchanged (removed and replaced with normal saline) to treat symptomatic neonatal polycythemia. The calculation determines the volume required to lower the central hematocrit to a safe target level.
Usage
neonatal_partial_exchange(weight_kg, current_hct, desired_hct = 55,
blood_volume_ml_kg = 80)
Arguments
weight_kg |
Numeric. The infant's weight in kilograms. |
current_hct |
Numeric. The infant's current central hematocrit percentage (e.g., 70). |
desired_hct |
Numeric. The target hematocrit percentage. Defaults to 55% (common clinical target). |
blood_volume_ml_kg |
Numeric. Estimated total blood volume per kilogram. Defaults to 80 mL/kg (standard estimate for term infants). Range typically 80-90 mL/kg. |
Details
The formula used is:
Volume_{exchange} = \frac{TBV \times (Hct_{current} - Hct_{desired})}{Hct_{current}}
Where TBV (Total Blood Volume) = Weight \times 80 mL/kg.
Value
A list containing:
Volume_to_Exchange_mL |
The calculated volume of blood to exchange for normal saline. |
Total_Blood_Volume_mL |
The estimated total blood volume of the infant. |
References
Wiswell TE, Cornish JD, Northam RS. Neonatal polycythemia: frequency of clinical manifestations and other associated findings. Pediatrics. 1986;78(1):26-30.
Examples
# Example 1: Symptomatic Polycythemia
# 3.5 kg infant, Hct 70%, Target 55%
# TBV = 3.5 * 80 = 280 mL
# Exchange = (280 * (70 - 55)) / 70 = 60 mL
neonatal_partial_exchange(3.5, 70, 55)
# Example 2: Higher TBV Estimate
# 4.0 kg infant, Hct 68%, Target 50%, TBV est 90 mL/kg
neonatal_partial_exchange(4.0, 68, 50, 90)
Neutrophil-Lymphocyte Ratio (NLR)
Description
Calculates the Neutrophil-Lymphocyte Ratio (NLR), a readily available biomarker of systemic inflammation and stress. It is used as a prognostic indicator in various conditions including sepsis, COVID-19, cardiovascular disease, and solid tumors. Elevated NLR is generally associated with worse outcomes.
Usage
neutrophil_lymphocyte_ratio(neutrophil_count, lymphocyte_count)
Arguments
neutrophil_count |
Numeric. The absolute neutrophil count (ANC) or percentage of neutrophils. |
lymphocyte_count |
Numeric. The absolute lymphocyte count (ALC) or percentage of lymphocytes. Note: Inputs must use the same unit (absolute count or percentage) for the ratio to be valid. |
Value
A list containing:
NLR |
The calculated ratio (Neutrophils / Lymphocytes). |
Interpretation |
General clinical context regarding normal vs. elevated ranges. |
References
Zahorec R. Ratio of neutrophil to lymphocyte counts–rapid and simple parameter of systemic inflammation and stress in critically ill. Bratisl Lek Listy. 2001;102(1):5-14. Liu Y, Du X, Chen J, et al. Neutrophil-to-lymphocyte ratio as an independent risk factor for mortality in hospitalized patients with COVID-19. J Infect. 2020;81(1):e6-e12. doi:10.1016/j.jinf.2020.04.002
Examples
# Example 1: Normal Range
# Neutrophils 4000, Lymphocytes 2000
# NLR = 2.0
neutrophil_lymphocyte_ratio(4000, 2000)
# Example 2: Elevated (Severe Infection/Stress)
# Neutrophils 8000, Lymphocytes 500
# NLR = 16.0
neutrophil_lymphocyte_ratio(8000, 500)
New Orleans Charity Head Trauma/Injury Rule
Description
Calculates the New Orleans Charity Head Trauma Rule result. This clinical decision rule identifies patients with minor head injury (GCS 15) who require a CT scan to rule out intracranial injury. If any one of the seven criteria is present, a CT is indicated.
Usage
new_orleans_head_ct_rule(headache, vomiting, age_gt_60, intoxication,
anterograde_amnesia, trauma_above_clavicles, seizure)
Arguments
headache |
Numeric (0 or 1). Is headache present? (1 = Yes). |
vomiting |
Numeric (0 or 1). Is vomiting present? (1 = Yes). |
age_gt_60 |
Numeric (0 or 1). Is the patient older than 60 years? (1 = Yes). |
intoxication |
Numeric (0 or 1). Is there drug or alcohol intoxication? (1 = Yes). |
anterograde_amnesia |
Numeric (0 or 1). Is there persistent anterograde amnesia (short-term memory deficits)? (1 = Yes). |
trauma_above_clavicles |
Numeric (0 or 1). Is there visible trauma above the clavicles? (1 = Yes). |
seizure |
Numeric (0 or 1). Did a seizure occur? (1 = Yes). |
Value
A list containing:
Recommendation |
Guidance on whether a CT scan is indicated. |
Criteria_Met_Count |
The number of positive criteria found. |
References
Haydel MJ, Preston CA, Mills TJ, Luber S, Blaudeau E, DeBlieux PM. Indications for computed tomography in patients with minor head injury. N Engl J Med. 2000;343(2):100-105. doi:10.1056/NEJM200007133430204
Examples
# Example 1: CT Indicated
# Headache (1), no other signs
new_orleans_head_ct_rule(1, 0, 0, 0, 0, 0, 0)
# Example 2: CT Not Indicated
# No criteria met
new_orleans_head_ct_rule(0, 0, 0, 0, 0, 0, 0)
National Early Warning Score 2 (NEWS2)
Description
Calculates the NEWS2 score, an updated track-and-trigger system for acute illness severity. NEWS2 includes two SpO2 scales: Scale 1 for standard patients and Scale 2 for patients with hypercapnic respiratory failure (e.g., COPD) who have a target saturation of 88-92%. It also accounts for new confusion in the consciousness assessment (ACVPU).
Usage
news2_score(respiratory_rate, oxygen_saturation, supplemental_oxygen,
systolic_bp, heart_rate, consciousness, temperature,
hypercapnic_respiratory_failure = FALSE)
Arguments
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. |
oxygen_saturation |
Numeric. Oxygen saturation percentage (SpO2). |
supplemental_oxygen |
Numeric (0 or 1). Is the patient receiving supplemental oxygen? (1 = Yes, +2 points). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
heart_rate |
Numeric. Heart rate in beats per minute. |
consciousness |
String. Level of consciousness: "alert", "confusion", "voice", "pain", "unresponsive". Any status other than "alert" scores 3 points. |
temperature |
Numeric. Body temperature in degrees Celsius. |
hypercapnic_respiratory_failure |
Numeric or Logical (0/1 or FALSE/TRUE). Does the patient have confirmed hypercapnic respiratory failure (e.g., COPD) requiring a target SpO2 of 88-92%? If TRUE, SpO2 points are calculated using Scale 2. |
Value
A list containing:
NEWS2_Score |
The calculated total score (Range 0-20). |
Clinical_Risk |
Risk classification (Low, Low-Medium, Medium, High). |
Response_Urgency |
Recommended clinical response level. |
References
Royal College of Physicians. National Early Warning Score (NEWS) 2: Standardising the assessment of acute-illness severity in the NHS. Updated report of a working party. London: RCP, 2017.
Examples
# Example 1: COPD Patient (Scale 2)
# RR 22 (+2), SpO2 90% (0 on Scale 2), On O2 (+2), SBP 130, HR 80, Alert, Temp 37
# Score = 4
news2_score(22, 90, 1, 130, 80, "alert", 37.0, hypercapnic_respiratory_failure = TRUE)
# Example 2: Standard Patient (Scale 1)
# RR 12, SpO2 93% (+2), No O2, SBP 100 (+2), HR 115 (+2), New Confusion (+3), Temp 38.5 (+1)
# Score = 10
news2_score(12, 93, 0, 100, 115, "confusion", 38.5)
National Early Warning Score (NEWS)
Description
Calculates the National Early Warning Score (NEWS) to standardize the assessment of acute illness severity. The score is based on seven physiological parameters: Respiratory Rate, Oxygen Saturation, Supplemental Oxygen use, Temperature, Systolic BP, Heart Rate, and AVPU score.
Usage
news_score(respiratory_rate, oxygen_saturation, any_supplemental_oxygen,
temperature_c, systolic_bp, heart_rate, avpu_score)
Arguments
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. |
oxygen_saturation |
Numeric. Oxygen saturation percentage (SpO2). |
any_supplemental_oxygen |
Numeric (0 or 1). Is the patient receiving supplemental oxygen? (1 = Yes, +2 points). |
temperature_c |
Numeric. Body temperature in degrees Celsius. |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
heart_rate |
Numeric. Heart rate in beats per minute. |
avpu_score |
String. Level of consciousness: "alert", "voice", "pain", "unresponsive". Any response other than "alert" scores 3 points. |
Value
A list containing:
NEWS_Score |
The calculated total score (Range 0-20). |
Risk_Category |
Classification of clinical risk (Low, Medium, High). |
Response_Level |
Recommended clinical response urgency. |
References
Royal College of Physicians. National Early Warning Score (NEWS): Standardising the assessment of acute-illness severity in the NHS. Report of a working party. London: RCP, 2012.
Examples
# Example 1: Low Risk
# RR 18, SpO2 98, No O2, Temp 37, SBP 130, HR 70, Alert
news_score(18, 98, 0, 37.0, 130, 70, "alert")
# Example 2: High Risk
# RR 26 (+3), SpO2 90 (+3), On O2 (+2), Temp 39 (+1), SBP 100 (+1), HR 120 (+2), Verbal (+3)
# Score = 15
news_score(26, 90, 1, 39.0, 100, 120, "voice")
Newsom Score for Non-Traumatic Chest Pain (CXR Rule)
Description
Calculates the Newsom Score to determine the necessity of a chest radiograph (CXR) in patients presenting to the emergency department with non-traumatic chest pain. The rule identifies patients at low risk for significant intrathoracic pathology (e.g., pneumonia, heart failure, pneumothorax, malignancy) who may be safely managed without a chest x-ray.
Usage
newsom_chest_pain_score(age, history_chf, history_smoking, hemoptysis,
history_tuberculosis, history_thromboembolism,
alcohol_abuse, temp_c, oxygen_saturation,
respiratory_rate, diminished_breath_sounds, rales)
Arguments
age |
Numeric. Patient age in years. (Age >= 60 adds 1 point). |
history_chf |
Numeric (0 or 1). History of Congestive Heart Failure. (1 = Yes). |
history_smoking |
Numeric (0 or 1). History of smoking. (1 = Yes). |
hemoptysis |
Numeric (0 or 1). Presence of hemoptysis. (1 = Yes). |
history_tuberculosis |
Numeric (0 or 1). History of tuberculosis. (1 = Yes). |
history_thromboembolism |
Numeric (0 or 1). History of thromboembolic disease (DVT/PE). (1 = Yes). |
alcohol_abuse |
Numeric (0 or 1). Prior or current alcohol abuse. (1 = Yes). |
temp_c |
Numeric. Body temperature in degrees Celsius. (>= 38.0 C adds 1 point). |
oxygen_saturation |
Numeric. Oxygen saturation percentage (SpO2). (< 90% adds 1 point). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. (> 24 bpm adds 1 point). |
diminished_breath_sounds |
Numeric (0 or 1). Diminished breath sounds on auscultation. (1 = Yes). |
rales |
Numeric (0 or 1). Presence of rales/crackles on auscultation. (1 = Yes). |
Value
A list containing:
Newsom_Score |
The total count of positive criteria. |
Risk_Category |
"Low Risk" if score is 0, otherwise "Not Low Risk". |
Recommendation |
Clinical guidance regarding the need for a Chest X-ray. |
References
Newsom C, et al. A clinical prediction rule for ordering chest radiographs in patients with non-traumatic chest pain. (Study validated in emergency settings).
Examples
# Example 1: Low Risk (No CXR needed)
# 45yo, No history, Normal vitals, Clear lungs
newsom_chest_pain_score(45, 0, 0, 0, 0, 0, 0, 37.0, 98, 16, 0, 0)
# Example 2: Not Low Risk (CXR indicated)
# 70yo (+1), Hx CHF (+1), Rales (+1)
newsom_chest_pain_score(70, 1, 0, 0, 0, 0, 0, 37.0, 95, 20, 0, 1)
NEXUS Criteria for C-Spine Imaging
Description
Calculates the NEXUS (National Emergency X-Radiography Utilization Study) criteria result to determine the need for cervical spine imaging in blunt trauma patients. If all five criteria are absent, the patient is considered low risk and can be cleared clinically without imaging.
Usage
nexus_c_spine_criteria(focal_neurologic_deficit, midline_spinal_tenderness,
altered_level_of_consciousness, intoxication,
distracting_injury)
Arguments
focal_neurologic_deficit |
Numeric (0 or 1). Presence of focal neurologic deficit. (1 = Yes). |
midline_spinal_tenderness |
Numeric (0 or 1). Presence of posterior midline cervical spinal tenderness. (1 = Yes). |
altered_level_of_consciousness |
Numeric (0 or 1). Presence of an altered level of consciousness (GCS < 15, disorientation, etc.). (1 = Yes). |
intoxication |
Numeric (0 or 1). Is there evidence of intoxication? (1 = Yes). |
distracting_injury |
Numeric (0 or 1). Is there a painful distracting injury? (1 = Yes). |
Value
A list containing:
Result |
Recommendation regarding the need for C-spine imaging ("Indicated" or "Not Indicated"). |
Inputs |
A summary of the criteria evaluated. |
References
Hoffman JR, Mower WR, Wolfson AB, et al. Validity of a set of clinical criteria to rule out injury to the cervical spine in patients with blunt trauma. N Engl J Med. 2000;343(2):94-99. doi:10.1056/NEJM200007133430203
Examples
# Example 1: Low Risk (Cleared)
# No deficits, no tenderness, alert, sober, no distracting injury
nexus_c_spine_criteria(0, 0, 0, 0, 0)
# Example 2: Imaging Indicated (Distracting Injury)
# Distracting injury present
nexus_c_spine_criteria(0, 0, 0, 0, 1)
NEXUS Chest CT Decision Instrument
Description
Calculates the NEXUS Chest CT result to determine the need for chest CT imaging in blunt trauma patients (>14 years old) evaluated within 6 hours of injury. If any one of the seven criteria is present, the patient is not considered low risk, and imaging is indicated.
Usage
nexus_chest_ct_rule(age, rapid_deceleration, chest_pain, intoxication,
abnormal_alertness, distracting_injury, chest_wall_tenderness)
Arguments
age |
Numeric. Patient age in years. (Age > 60 is a risk factor). |
rapid_deceleration |
Numeric (0 or 1). Mechanism of rapid deceleration (e.g., fall > 20 ft / 6 m, or MVA > 40 mph / 64 kph with sudden deceleration). (1 = Yes). |
chest_pain |
Numeric (0 or 1). Presence of chest pain. (1 = Yes). |
intoxication |
Numeric (0 or 1). Is the patient intoxicated? (1 = Yes). |
abnormal_alertness |
Numeric (0 or 1). Abnormal alertness or mental status (GCS < 15 or disorientation). (1 = Yes). |
distracting_injury |
Numeric (0 or 1). Presence of a distracting painful injury. (1 = Yes). |
chest_wall_tenderness |
Numeric (0 or 1). Tenderness to chest wall palpation. (1 = Yes). |
Value
A list containing:
Result |
Recommendation regarding the indication for Chest CT ("Indicated" or "Not Indicated"). |
Inputs |
A summary of the criteria evaluated. |
References
Rodriguez RM, et al. Derivation and validation of two decision instruments for selective chest CT in blunt trauma: a multicenter prospective observational study (NEXUS Chest CT). PLoS Med. 2015;12(10):e1001883. doi:10.1371/journal.pmed.1001883
Examples
# Example 1: Low Risk
# 30yo, Fall <10ft, No pain, Alert, No other injuries
nexus_chest_ct_rule(30, 0, 0, 0, 0, 0, 0)
# Example 2: Indicated (Chest pain)
# 45yo, MVA, Chest pain present
nexus_chest_ct_rule(45, 1, 1, 0, 0, 0, 0)
NEXUS Head CT Decision Instrument
Description
Calculates the NEXUS Head CT result to determine the need for head CT imaging in blunt head trauma patients. If any one of the eight criteria is present, the patient is not considered low risk, and imaging is indicated.
Usage
nexus_head_ct_rule(age_ge_65, skull_fracture_evidence, scalp_hematoma,
neurologic_deficit, altered_alertness, abnormal_behavior,
coagulopathy, persistent_vomiting)
Arguments
age_ge_65 |
Numeric (0 or 1). Is the patient 65 years of age or older? (1 = Yes). |
skull_fracture_evidence |
Numeric (0 or 1). Evidence of significant skull fracture? (1 = Yes). |
scalp_hematoma |
Numeric (0 or 1). Scalp hematoma present? (1 = Yes). |
neurologic_deficit |
Numeric (0 or 1). Neurologic deficit present? (1 = Yes). |
altered_alertness |
Numeric (0 or 1). Altered level of alertness? (1 = Yes). |
abnormal_behavior |
Numeric (0 or 1). Abnormal behavior present? (1 = Yes). |
coagulopathy |
Numeric (0 or 1). Coagulopathy present? (1 = Yes). |
persistent_vomiting |
Numeric (0 or 1). Persistent vomiting? (1 = Yes). |
Value
A list containing:
Result |
Recommendation regarding the need for Head CT ("Indicated" or "Not Indicated"). |
Inputs |
A summary of the criteria evaluated. |
References
Mower WR, Hoffman JR, Herbert M, et al. Developing a decision instrument to guide computed tomographic imaging of blunt head injury patients. J Trauma. 2005;59(4):954-959. doi:10.1097/01.ta.0000187813.79047.42
Examples
# Example 1: Low Risk
# No criteria present
nexus_head_ct_rule(0, 0, 0, 0, 0, 0, 0, 0)
# Example 2: Indicated (Age)
# 70yo, no other findings
nexus_head_ct_rule(1, 0, 0, 0, 0, 0, 0, 0)
NIH Stroke Scale (NIHSS)
Description
Calculates the National Institutes of Health Stroke Scale (NIHSS), a systematic assessment tool that provides a quantitative measure of stroke-related neurologic deficit. The scale is widely used to evaluate stroke severity, determine appropriate treatment, and predict patient outcomes.
Usage
nih_stroke_scale(loc_response, loc_questions, loc_commands, gaze, visual_fields,
facial_palsy, motor_arm_left, motor_arm_right, motor_leg_left,
motor_leg_right, limb_ataxia, sensory, best_language, dysarthria,
extinction_inattention)
Arguments
loc_response |
Numeric (0-3). 1a: Level of Consciousness. |
loc_questions |
Numeric (0-2). 1b: LOC Questions (Month and Age). |
loc_commands |
Numeric (0-2). 1c: LOC Commands (Open/close eyes, grip/release hand). |
gaze |
Numeric (0-2). 2: Best Gaze. |
visual_fields |
Numeric (0-3). 3: Visual Fields. |
facial_palsy |
Numeric (0-3). 4: Facial Palsy. |
motor_arm_left |
Numeric (0-4). 5a: Motor Arm (Left). |
motor_arm_right |
Numeric (0-4). 5b: Motor Arm (Right). |
motor_leg_left |
Numeric (0-4). 6a: Motor Leg (Left). |
motor_leg_right |
Numeric (0-4). 6b: Motor Leg (Right). |
limb_ataxia |
Numeric (0-2). 7: Limb Ataxia. |
sensory |
Numeric (0-2). 8: Sensory. |
best_language |
Numeric (0-3). 9: Best Language. |
dysarthria |
Numeric (0-2). 10: Dysarthria. |
extinction_inattention |
Numeric (0-2). 11: Extinction and Inattention (Neglect). |
Value
A list containing:
NIHSS_Score |
The calculated total score (Range 0-42). |
Severity |
Interpretation of stroke severity (Minor, Moderate, Severe). |
References
Brott T, Adams HP Jr, Olinger CP, et al. Measurements of acute cerebral infarction: a clinical examination scale. Stroke. 1989;20(7):864-870. doi:10.1161/01.str.20.7.864
Examples
# Example 1: Moderate Stroke
# Alert(0), Questions(1), Gaze(1), Face(2), Arm Drift(1), Leg Drift(1), Sensory(1), Mild Aphasia(1)
nih_stroke_scale(0, 1, 0, 1, 0, 2, 1, 0, 1, 0, 0, 1, 1, 0, 0)
# Example 2: Severe Stroke
# Drowsy(1), Gaze(2), Hemianopia(2), Face(3), Arm/Leg Paralysis(4,4), Global Aphasia(3), Neglect(2)
nih_stroke_scale(1, 2, 2, 2, 2, 3, 4, 0, 4, 0, 0, 2, 3, 2, 2)
NINCDS-ADRDA Criteria for Alzheimer's Disease
Description
Evaluates the NINCDS-ADRDA (National Institute of Neurological and Communicative Disorders and Stroke and the Alzheimer's Disease and Related Disorders Association) clinical criteria for the diagnosis of Alzheimer's Disease. The criteria classify patients into Definite, Probable, or Possible Alzheimer's Disease based on clinical findings and exclusion of other causes.
Usage
nincds_adrda_criteria(dementia_established, multiple_cognitive_deficits,
progressive_worsening, no_consciousness_disturbance,
onset_age_40_90, absence_of_other_disorders,
histopathology_evidence = 0)
Arguments
dementia_established |
Numeric (0 or 1). Dementia established by clinical examination and documented by the Mini-Mental Test, Blessed Dementia Scale, or similar examination. (1 = Yes). |
multiple_cognitive_deficits |
Numeric (0 or 1). Deficits in two or more areas of cognition. (1 = Yes). |
progressive_worsening |
Numeric (0 or 1). Progressive worsening of memory and other cognitive functions. (1 = Yes). |
no_consciousness_disturbance |
Numeric (0 or 1). No disturbance of consciousness. (1 = Yes). |
onset_age_40_90 |
Numeric (0 or 1). Onset between ages 40 and 90. (1 = Yes). |
absence_of_other_disorders |
Numeric (0 or 1). Absence of systemic disorders or other brain diseases that could account for the progressive deficits in memory and cognition. (1 = Yes). |
histopathology_evidence |
Numeric (0 or 1). Histopathologic evidence of Alzheimer's Disease obtained from biopsy or autopsy. (1 = Yes). Required for "Definite" diagnosis. |
Value
A list containing:
Diagnosis |
The resulting diagnostic classification: "Definite Alzheimer's Disease", "Probable Alzheimer's Disease", "Possible Alzheimer's Disease", or "Unlikely Alzheimer's Disease". |
References
McKhann G, Drachman D, Folstein M, Katzman R, Price D, Stadlan EM. Clinical diagnosis of Alzheimer's disease: report of the NINCDS-ADRDA Work Group under the auspices of Department of Health and Human Services Task Force on Alzheimer's Disease. Neurology. 1984;34(7):939-944. doi:10.1212/wnl.34.7.939
Examples
# Example 1: Probable AD
# All core criteria met, no biopsy
nincds_adrda_criteria(1, 1, 1, 1, 1, 1, 0)
# Example 2: Definite AD
# All core criteria met + Biopsy confirmed
nincds_adrda_criteria(1, 1, 1, 1, 1, 1, 1)
# Example 3: Possible AD (Comorbidity)
# All core criteria met EXCEPT absence of other disorders (0)
nincds_adrda_criteria(1, 1, 1, 1, 1, 0, 0)
NIRUDAK Score for Dehydration in Children
Description
Calculates the NIRUDAK (Novel Innovative Research Understanding Dehydration) Score, a clinical prediction rule to assess the severity of dehydration in children. The score uses a combination of six easily assessable clinical signs to predict significant dehydration (e.g., \ge 5% weight loss).
Usage
nirudak_score(crt_seconds, tachycardia_present, lethargy_coma, dry_mucous_membranes,
cold_mottled_extremities, sunken_eyes)
Arguments
crt_seconds |
Numeric. Capillary Refill Time (CRT) in seconds. ( |
tachycardia_present |
Numeric (0 or 1). Presence of tachycardia (Heart Rate greater than the 90th percentile for age). (1 = Yes, +2 points). |
lethargy_coma |
Numeric (0 or 1). Altered mental status (lethargy or comatose). (1 = Yes, +2 points). |
dry_mucous_membranes |
Numeric (0 or 1). Dry mucous membranes (DMM) present. (1 = Yes, +1 point). |
cold_mottled_extremities |
Numeric (0 or 1). Presence of cold or mottled extremities. (1 = Yes, +2 points). |
sunken_eyes |
Numeric (0 or 1). Sunken eyes present. (1 = Yes, +1 point). |
Value
A list containing:
NIRUDAK_Score |
The calculated total score (Range 0-10). |
Risk_Level |
Risk stratification (Low < 3, Moderate 3-5, High |
References
Jackson MC, et al. A clinical prediction rule for significant dehydration in children: The NIRUDAK score. Lancet. 2018;391(10116):159-166.
Examples
# Example 1: High Risk (Severe Dehydration Likely)
# CRT 4s (+2), Tachycardia (+2), Cold Extremities (+2)
# Score = 6
nirudak_score(4, 1, 0, 0, 1, 0)
# Example 2: Low Risk
# CRT 2s, No tachycardia, Dry Mucous Membranes (+1)
# Score = 1
nirudak_score(2, 0, 0, 1, 0, 0)
NIVO Score for COPD Exacerbation
Description
Calculates the Non-invasive Ventilation Outcomes (NIVO) score to predict in-hospital mortality in patients hospitalized with an acute exacerbation of COPD requiring non-invasive ventilation (NIV). The score is derived from the eMRCD dyspnea score, acidemia, chest radiograph findings, GCS, and presence of atrial fibrillation.
Usage
nivo_score(emrcd_score, arterial_ph, consolidation_cxr, gcs_score,
atrial_fibrillation)
Arguments
emrcd_score |
String. Extended MRC Dyspnea Score. "1_4": Not housebound (0 points). "5a": Housebound but independent washing/dressing (2 points). "5b": Housebound and dependent for washing/dressing (4 points). |
arterial_ph |
Numeric. Arterial pH at initiation of NIV. (< 7.25 adds 2 points). |
consolidation_cxr |
Numeric (0 or 1). Presence of consolidation on Chest X-ray. (1 = Yes, +2 points). |
gcs_score |
Numeric. Glasgow Coma Scale score. (< 15 adds 2 points). |
atrial_fibrillation |
Numeric (0 or 1). Presence of Atrial Fibrillation (history or new). (1 = Yes, +1 point). |
Value
A list containing:
NIVO_Score |
The calculated total score (Range 0-11). |
Risk_Category |
Risk classification (Low to Highest). |
In_Hospital_Mortality |
Estimated in-hospital mortality percentage. |
References
Hartley T, Lane ND, Steer J, et al. Predicting in-hospital mortality in patients with acute exacerbations of chronic obstructive pulmonary disease requiring non-invasive ventilation: the NIVO score. Thorax. 2021;76(8):777-783. doi:10.1136/thoraxjnl-2020-215841
Examples
# Example 1: High Risk
# eMRCD 5b (4), pH 7.20 (2), No consolidation, GCS 15, No AF
# Score = 4 + 2 = 6
nivo_score("5b", 7.20, 0, 15, 0)
# Example 2: Low Risk
# eMRCD 1-4 (0), pH 7.30 (0), No consolidation, GCS 15, No AF
# Score = 0
nivo_score("1_4", 7.30, 0, 15, 0)
Novel Pneumonia Risk Score (PRS)
Description
Calculates the Novel Pneumonia Risk Score (PRS) to estimate the risk of developing community-acquired pneumonia in primary care patients. The score is based on age, sex, comorbidities (heart failure, COPD, epilepsy, Parkinson's), history of pneumonia, and current medication use (PPIs, opioids).
Usage
novel_pneumonia_risk_score(age, sex, heart_failure, copd, epilepsy,
parkinsons, previous_pneumonia, current_ppi_use,
current_opioid_use)
Arguments
age |
Numeric. Patient age in years. (Score adds Age / 10). |
sex |
String. Patient sex ("Male" or "Female"). (Male adds 1 point). |
heart_failure |
Numeric (0 or 1). History of heart failure. (1 = Yes, +1 point). |
copd |
Numeric (0 or 1). History of COPD. (1 = Yes, +1 point). |
epilepsy |
Numeric (0 or 1). History of epilepsy. (1 = Yes, +1 point). |
parkinsons |
Numeric (0 or 1). History of Parkinson's disease. (1 = Yes, +1 point). |
previous_pneumonia |
Numeric (0 or 1). History of previous pneumonia (within the last 3 years). (1 = Yes, +3 points). |
current_ppi_use |
Numeric (0 or 1). Current use of Proton Pump Inhibitors (PPIs). (1 = Yes, +2 points). |
current_opioid_use |
Numeric (0 or 1). Current use of opioids. (1 = Yes, +2 points). |
Value
A list containing:
PRS_Score |
The calculated risk score. |
Risk_Category |
Classification (Low < 10, Medium 10-15, High > 15). |
References
Hamilton F, et al. A simple clinical risk score to predict the risk of pneumonia in primary care. Eur Respir J. 2019.
Examples
# Example 1: Low Risk
# 50yo Female, No comorbidities
# Score = 5.0
novel_pneumonia_risk_score(50, "female", 0, 0, 0, 0, 0, 0, 0)
# Example 2: High Risk
# 75yo Male (+8.5), COPD (+1), Prev Pneumonia (+3), PPI (+2)
# Score = 7.5 + 1 + 1 + 3 + 2 = 14.5 (Medium/High border)
novel_pneumonia_risk_score(75, "male", 0, 1, 0, 0, 1, 1, 0)
Neuropathic Pain Scale (NPS)
Description
Calculates the Neuropathic Pain Scale (NPS) score. Unlike diagnostic tools (e.g., DN4), the NPS is designed to assess the distinct qualities of neuropathic pain (e.g., sharp, hot, dull) and monitor changes in these specific symptoms over time or in response to treatment.
Usage
nps_pain_scale(intensity, sharp, hot, dull, cold, sensitive, itchy,
unpleasant, deep, surface)
Arguments
intensity |
Numeric (0-10). How intense is the pain? (0=No pain, 10=Most intense pain imaginable). |
sharp |
Numeric (0-10). How sharp is the pain? (0=Not sharp, 10=Most sharp sensation imaginable). |
hot |
Numeric (0-10). How hot is the pain? (0=Not hot, 10=Most hot sensation imaginable). |
dull |
Numeric (0-10). How dull is the pain? (0=Not dull, 10=Most dull sensation imaginable). |
cold |
Numeric (0-10). How cold is the pain? (0=Not cold, 10=Most cold sensation imaginable). |
sensitive |
Numeric (0-10). How sensitive is the skin to light touch/clothing? (0=Not sensitive, 10=Most sensitive sensation imaginable). |
itchy |
Numeric (0-10). How itchy is the pain? (0=Not itchy, 10=Most itchy sensation imaginable). |
unpleasant |
Numeric (0-10). How unpleasant is the pain? (0=Not unpleasant, 10=Most unpleasant sensation imaginable). |
deep |
Numeric (0-10). How intense is the deep pain? (0=No deep pain, 10=Most intense deep pain imaginable). |
surface |
Numeric (0-10). How intense is the surface pain? (0=No surface pain, 10=Most intense surface pain imaginable). |
Value
A list containing:
NPS_Total_Score |
The sum of all 10 item scores (Range 0-100). |
Interpretation |
Guidance on using the score for monitoring treatment response. |
Domain_Scores |
A breakdown of the individual pain quality scores. |
References
Galer BS, Jensen MP. Development and preliminary validation of a pain measure specific to neuropathic pain: the Neuropathic Pain Scale. Neurology. 1997;48(2):332-338. doi:10.1212/wnl.48.2.332
Examples
# Example 1: High Sharp/Sensitive Pain
# Intensity(8), Sharp(9), Hot(2), Dull(1), Cold(0), Sensitive(9),
# Itchy(0), Unpleasant(8), Deep(2), Surface(9)
# Total = 48
nps_pain_scale(8, 9, 2, 1, 0, 9, 0, 8, 2, 9)
# Example 2: Low Intensity
# All items scored 1
# Total = 10
nps_pain_scale(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
Nutritional Risk Index (NRI)
Description
Calculates the Nutritional Risk Index (NRI) to assess the extent of malnutrition in patients, particularly in surgical or elderly populations. The score uses serum albumin levels and the ratio of current to usual body weight to stratify patients into risk categories.
Usage
nri_score(albumin_g_dl, current_weight_kg, usual_weight_kg)
Arguments
albumin_g_dl |
Numeric. Serum Albumin level in g/dL. Note: The formula converts this to g/L internally. |
current_weight_kg |
Numeric. The patient's current weight in kilograms. |
usual_weight_kg |
Numeric. The patient's usual or baseline weight in kilograms. |
Details
The formula used is:
NRI = (1.519 \times Albumin_{g/L}) + 41.7 \times \frac{Current Weight}{Usual Weight}
Note: If Current Weight exceeds Usual Weight, the weight ratio is set to 1 to avoid overestimating nutritional status in obese patients with hypoalbuminemia.
Value
A list containing:
NRI_Score |
The calculated index value. |
Risk_Category |
Clinical interpretation of the score (> 100: No Risk, 97.5 - 100: Mild Risk, 83.5 - <97.5: Moderate Risk, < 83.5: Severe Risk). |
References
Buzby GP, et al. Prognostic nutritional index in gastrointestinal surgery. Am J Surg. 1980;139(1):160-167. doi:10.1016/0002-9610(80)90246-9 Veterans Affairs Total Parenteral Nutrition Cooperative Study Group. Perioperative total parenteral nutrition in surgical patients. N Engl J Med. 1991;325(8):525-532. doi:10.1056/NEJM199108223250801
Examples
# Example 1: Normal Status
# Albumin 4.5 g/dL (45 g/L), Weight stable (Ratio 1)
# Score = (1.519 * 45) + 41.7 = 68.355 + 41.7 = 110.1
nri_score(4.5, 70, 70)
# Example 2: Severe Risk
# Albumin 2.5 g/dL (25 g/L), Significant weight loss (55/70 = 0.785)
# Score = (1.519 * 25) + (41.7 * 0.785) = 37.975 + 32.73 = 70.7
nri_score(2.5, 55, 70)
Natriuretic Response Prediction Equation (NRPE)
Description
Calculates the predicted 6-hour cumulative sodium output based on a single spot urine sodium sample taken 2 hours after loop diuretic administration. This tool helps evaluate diuretic resistance and guide titration in patients with acute heart failure.
Usage
nrpe_diuretic_response(spot_urine_sodium)
Arguments
spot_urine_sodium |
Numeric. Spot urine sodium concentration (mmol/L or mEq/L) measured 2 hours after diuretic administration. |
Value
A list containing:
Predicted_6hr_Sodium_Output_mmol |
The estimated total sodium excretion over 6 hours. |
Interpretation |
Assessment of response adequacy based on the common threshold of 50 mmol/L. |
References
Rao VS, Ivey-Miranda JB, Cox ZL, et al. Natriuretic Equation to Predict Loop Diuretic Response in Patients With Heart Failure. J Am Coll Cardiol. 2019;74(7):861-868. doi:10.1016/j.jacc.2019.06.028
Examples
# Example 1: Poor Response
# Spot Na 30 mmol/L
nrpe_diuretic_response(30)
# Example 2: Good Response
# Spot Na 100 mmol/L
nrpe_diuretic_response(100)
Nutrition Risk Screening 2002 (NRS-2002)
Description
Calculates the NRS-2002 score to assess nutritional risk in hospitalized patients. The score is the sum of a nutritional status score (0-3), a disease severity score (0-3), and an age adjustment (+1 for age >= 70).
Usage
nrs_2002_score(nutritional_score, disease_severity_score, age)
Arguments
nutritional_score |
Numeric (0-3). Impaired nutritional status. 0: Absent. 1 (Mild): Weight loss >5% in 3 months OR Food intake 50-75% in preceding week. 2 (Moderate): Weight loss >5% in 2 months OR BMI 18.5-20.5 + impaired general condition OR Food intake 25-50% in preceding week. 3 (Severe): Weight loss >5% in 1 month (>15% in 3 months) OR BMI <18.5 + impaired general condition OR Food intake 0-25% in preceding week. |
disease_severity_score |
Numeric (0-3). Severity of disease. 0: Normal nutritional requirements. 1 (Mild): Hip fracture, chronic patients with acute complications (cirrhosis, COPD, hemodialysis, diabetes, oncology). 2 (Moderate): Major abdominal surgery, stroke, severe pneumonia, hematologic malignancy. 3 (Severe): Head injury, bone marrow transplantation, intensive care patients (APACHE >10). |
age |
Numeric. Patient age in years. (Age >= 70 adds 1 point). |
Value
A list containing:
NRS_2002_Score |
The calculated total score (Range 0-7). |
Interpretation |
Clinical interpretation (Score >= 3 indicates nutritional risk). |
References
Kondrup J, Rasmussen HH, Hamberg O, Stanga Z; Ad Hoc ESPEN Working Group. Nutritional risk screening (NRS 2002): a new method based on an analysis of controlled clinical trials. Clin Nutr. 2003;22(3):321-336. doi:10.1016/s0261-5614(02)00214-5
Examples
# Example 1: At Risk
# Severe weight loss (3), Hip fracture (1), Age 75 (+1)
# Score = 3 + 1 + 1 = 5
nrs_2002_score(3, 1, 75)
# Example 2: Not At Risk
# Mild intake reduction (1), Normal requirements (0), Age 50 (0)
# Score = 1
nrs_2002_score(1, 0, 50)
Nutrition Risk in the Critically Ill (NUTRIC) Score
Description
Calculates the **NUTRIC Score** to assess the risk of adverse outcomes from under-nutrition in critically ill adult patients. The score integrates patient characteristics (age, BMI), baseline health status (comorbidities, SOFA score), and anticipated length of stay. The maximum score is 5 points for the standard NUTRIC score.
Usage
nutric_score(age, bmi, sofa_score, comorbidities_count, days_on_icu_ge_2,
il6_level_pg_ml = NA)
Arguments
age |
Numeric. Patient age in years. (50-74 years adds 1 point, |
bmi |
Numeric. Body Mass Index in kg/m^2. (BMI < 20 or |
sofa_score |
Numeric. Sequential Organ Failure Assessment (SOFA) score on admission. (SOFA 5-9 adds 1 point, SOFA |
comorbidities_count |
Numeric. Count of comorbidities (e.g., Cancer, CKD, Liver disease, CHF). ( |
days_on_icu_ge_2 |
Numeric (0 or 1). Anticipated length of stay in the ICU of 2 days or more. (1 = Yes, +1 point). |
il6_level_pg_ml |
Numeric (Optional). Interleukin-6 (IL-6) level in pg/mL. Used in the modified NUTRIC (mNUTRIC) score. ( |
Value
A list containing:
NUTRIC_Score |
The calculated risk score (Range 0-5). |
Risk_Classification |
Classification (Low Risk |
Nutrition_Recommendation |
Guidance on the intensity of nutrition support. |
References
*Original Derivation (NUTRIC):* Heyland DK, Dhaliwal R, Jiang X, et al. Identifying critically ill patients who benefit most from nutritional support: a systematic review and meta-analysis. Crit Care. 2011;15(4):R172. doi:10.1186/cc10362
*IL-6 Inclusion (mNUTRIC):* Rahman A, et al. Modified NUTRIC Score: Validation and Utility in Critical Care. J Am Coll Nutr. 2015.
Examples
# Example 1: Low Risk
# 40yo (0), BMI 25 (0), SOFA 2 (0), 1 comorbidity (0), <2 ICU days (0)
nutric_score(40, 25, 2, 1, 0)
# Example 2: High Risk
# 70yo (+1), BMI 35 (+1), SOFA 12 (+1), 2 comorbidities (+1), >=2 ICU days (+1)
# Score = 5
nutric_score(70, 35, 12, 2, 1)
Nonverbal Pain Scale (NVPS) for Nonverbal Patients
Description
Calculates the NVPS score to assess pain in patients who are unable to verbalize their pain (e.g., sedated, intubated, or cognitively impaired patients). The scale evaluates five categories: Face, Activity, Guarding, Physiology (Vital Signs), and Respiratory.
Usage
nvps_pain_score(face, activity, guarding, physiology_vital_signs, respiratory)
Arguments
face |
Numeric (0-2). 0: No particular expression or smile. 1: Occasional grimace, tearing, frowning, wrinkled forehead. 2: Frequent grimace, tearing, frowning, wrinkled forehead. |
activity |
Numeric (0-2). 0: Lying quietly, normal position. 1: Seeking attention through movement or slow/cautious movement. 2: Restless, excessive activity and/or withdrawal reflexes. |
guarding |
Numeric (0-2). 0: Lying quietly, no positioning of hands over areas of body. 1: Splinting areas of the body, tense. 2: Rigid, stiff. |
physiology_vital_signs |
Numeric (0-2). 0: Baseline vital signs unchanged. 1: Change in SBP > 20 mmHg or HR > 20 bpm. 2: Change in SBP > 30 mmHg or HR > 25 bpm. |
respiratory |
Numeric (0-2). 0: Baseline RR/SpO2/compliance unchanged. 1: RR > 10 above baseline, 5% decrease in SpO2, or mild ventilator dyssynchrony. 2: RR > 20 above baseline, 10% decrease in SpO2, or severe ventilator dyssynchrony. |
Value
A list containing:
NVPS_Score |
The calculated total score (Range 0-10). |
Interpretation |
Clinical interpretation of pain severity (No/Mild, Moderate, Severe). |
References
Odhner, M., Wegman, D., Freeland, N., Steinmetz, A., & Ingersoll, G. L. (2003). Assessing pain control in nonverbal critically ill adults. Dimensions of Critical Care Nursing, 22(6), 260-267.
Examples
# Example 1: Moderate Pain
# Grimacing(1), Restless(2), Rigid(2), Stable Vitals(0), Mild Dyssynchrony(1)
# Score = 6
nvps_pain_score(1, 2, 2, 0, 1)
# Example 2: No Pain
# All baseline/normal
# Score = 0
nvps_pain_score(0, 0, 0, 0, 0)
New York Heart Association (NYHA) Functional Classification
Description
Retrieves the clinical description for the NYHA Functional Classification. This system provides a simple way of classifying the extent of heart failure based on the severity of symptoms and physical activity limitation.
Usage
nyha_functional_classification(class_grade)
Arguments
class_grade |
Numeric (1-4). The assessed NYHA Class. 1: No limitation of physical activity. 2: Slight limitation of physical activity. 3: Marked limitation of physical activity. 4: Unable to carry on any physical activity without discomfort; symptoms at rest. |
Value
A list containing:
NYHA_Class |
The formatted class string (e.g., "Class I"). |
Description |
The clinical definition associated with the class. |
References
The Criteria Committee of the New York Heart Association. Nomenclature and Criteria for Diagnosis of Diseases of the Heart and Great Vessels. 9th ed. Boston, Mass: Little, Brown & Co; 1994:253-256.
Examples
# Example 1: Class II (Slight limitation)
nyha_functional_classification(2)
# Example 2: Class IV (Symptoms at rest)
nyha_functional_classification(4)
Oakland Score for Safe Discharge in Lower GI Bleed
Description
Calculates the Oakland Score to identify patients with lower gastrointestinal bleeding (LGIB) who are at low risk of adverse outcomes and can be safely discharged from the emergency department. A score of 8 or less indicates a 95% probability of safe discharge (defined as absence of rebleeding, transfusion, therapeutic intervention, in-hospital death, or readmission).
Usage
oakland_score_lgib(age, sex, previous_lgib_admission, dre_blood, heart_rate,
systolic_bp, hemoglobin, hemoglobin_units = "g/dL")
Arguments
age |
Numeric. Patient age in years. <40: 0 pts. 40-69: 0 pts. 70-79: 1 pt. >=80: 2 pts. |
sex |
String. Patient sex ("Male" or "Female"). Male adds 1 point. |
previous_lgib_admission |
Numeric (0 or 1). History of previous admission for lower GI bleed. (1 = Yes, +1 pt). |
dre_blood |
Numeric (0 or 1). Blood present on digital rectal examination. (1 = Yes, +1 pt). |
heart_rate |
Numeric. Heart rate in beats per minute. <70: 0 pts. 70-89: 1 pt. 90-109: 2 pts. >=110: 3 pts. |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. <90: 5 pts. 90-119: 4 pts. 120-129: 3 pts. 130-159: 2 pts. >=160: 0 pts. |
hemoglobin |
Numeric. Hemoglobin level. |
hemoglobin_units |
String. Units for hemoglobin input. Options: "g/dL" (default), "g/L", or "mmol/L". Scoring (g/L equivalent): <70: 22 pts. 70-89: 17 pts. 90-109: 13 pts. 110-129: 8 pts. 130-159: 4 pts. >=160: 0 pts. |
Value
A list containing:
Oakland_Score |
The calculated total score (Range 0-35+). |
Recommendation |
Guidance on discharge vs. admission based on the cutoff of 8. |
Probability_Safe_Discharge |
Estimated probability of safe outcome. |
References
Oakland K, Jairath V, Uberoi R, et al. Derivation and validation of a novel risk score for safe discharge after acute lower gastrointestinal bleeding. Gut. 2017;66(4):635-643. doi:10.1136/gutjnl-2015-311005
Examples
# Example 1: Low Risk (Safe Discharge)
# 45yo Female (0), No prev admit (0), No DRE blood (0), HR 65 (0), SBP 140 (2), Hb 14 (4)
# Score = 0 + 0 + 0 + 0 + 0 + 2 + 4 = 6
oakland_score_lgib(45, "female", 0, 0, 65, 140, 14.0)
# Example 2: High Risk (Admission)
# 75yo Male (1+1), Prev Admit (1), DRE Blood (1), HR 100 (2), SBP 100 (4), Hb 10 (13)
# Score = 1 + 1 + 1 + 1 + 2 + 4 + 13 = 23
oakland_score_lgib(75, "male", 1, 1, 100, 100, 10.0)
Obesity Surgery Mortality Risk Score (OS-MRS)
Description
Calculates the Obesity Surgery Mortality Risk Score (OS-MRS) to predict 90-day mortality in patients undergoing bariatric surgery. The score assigns 1 point for each of five risk factors: BMI >= 50 kg/m^2, Male sex, Hypertension, known risk factors for DVT/PE (e.g., prior thromboembolism, IVC filter, pulmonary hypertension), and Age >= 45 years.
Usage
obesity_surgery_mortality_risk_score(bmi_ge_50, male_sex, hypertension,
risk_factors_dvt_pe, age_ge_45)
Arguments
bmi_ge_50 |
Numeric (0 or 1). Is BMI >= 50 kg/m^2? (1 = Yes, +1 point). |
male_sex |
Numeric (0 or 1). Is the patient male? (1 = Yes, +1 point). |
hypertension |
Numeric (0 or 1). Does the patient have hypertension? (1 = Yes, +1 point). |
risk_factors_dvt_pe |
Numeric (0 or 1). Are there known risk factors for pulmonary embolism (e.g., history of DVT/PE, IVC filter, right heart failure)? (1 = Yes, +1 point). |
age_ge_45 |
Numeric (0 or 1). Is the patient age >= 45 years? (1 = Yes, +1 point). |
Value
A list containing:
OS_MRS_Score |
The calculated total score (Range 0-5). |
Risk_Class |
Classification (Class A: 0-1, Class B: 2-3, Class C: 4-5). |
Est_Mortality_90_Day |
Estimated 90-day postoperative mortality percentage. |
References
DeMaria EJ, Portenier DS, Wolfe L. Obesity surgery mortality risk score: proposal for a clinically useful score to predict mortality risk in patients undergoing gastric bypass. Surg Obes Relat Dis. 2007;3(2):134-140. doi:10.1016/j.soard.2007.01.005
Examples
# Example 1: High Risk
# BMI 55 (+1), Male (+1), HTN (+1), Prior DVT (+1), Age 50 (+1)
# Score = 5
obesity_surgery_mortality_risk_score(1, 1, 1, 1, 1)
# Example 2: Low Risk
# BMI 40 (0), Female (0), No HTN (0), No PE risk (0), Age 30 (0)
# Score = 0
obesity_surgery_mortality_risk_score(0, 0, 0, 0, 0)
OESIL Score for Syncope
Description
Calculates the OESIL (Osservatorio Epidemiologico sulla Sincope nel Lazio) Score to predict 1-year all-cause mortality in patients presenting to the emergency department with syncope. The score stratifies patients based on four simple clinical variables.
Usage
oesil_syncope_score(age, cv_history, no_prodrome, abnormal_ecg)
Arguments
age |
Numeric. Patient age in years. (> 65 years adds 1 point). |
cv_history |
Numeric (0 or 1). History of cardiovascular disease. (1 = Yes, +1 point). |
no_prodrome |
Numeric (0 or 1). Syncope occurring without prodromal symptoms. (1 = Yes, +1 point). |
abnormal_ecg |
Numeric (0 or 1). Abnormal electrocardiogram. (1 = Yes, +1 point). |
Value
A list containing:
OESIL_Score |
The calculated score (Range 0-4). |
Est_1_Year_Mortality |
Estimated 1-year mortality risk percentage based on the derivation cohort. |
References
Colivicchi F, Ammirati F, Melina D, et al. Development and validation of a prognostic scale for the prediction of death following syncope: the OESIL risk score. Eur Heart J. 2003;24(9):811-819. doi:10.1016/s0195-668x(03)00136-9
Examples
# Example 1: High Risk
# 70yo (+1), CV History (+1), Abnormal ECG (+1), Prodrome present (0)
# Score = 3
oesil_syncope_score(70, 1, 0, 1)
# Example 2: Low Risk
# 40yo, No history, No prodrome (+1), Normal ECG
# Score = 1
oesil_syncope_score(40, 0, 1, 0)
Ocular Hypertension Treatment Study (OHTS) Calculator
Description
Calculates the 5-year risk of developing Primary Open-Angle Glaucoma (POAG) in patients with Ocular Hypertension. This function utilizes the point-based scoring system derived from the OHTS and European Glaucoma Prevention Study (EGPS) pooled data. It considers Age, Intraocular Pressure (IOP), Central Corneal Thickness (CCT), Vertical Cup-Disc Ratio (VCDR), and Pattern Standard Deviation (PSD).
Usage
ohts_risk_score(age, iop, cct, vcdr, psd)
Arguments
age |
Numeric. Patient age in years. |
iop |
Numeric. Intraocular Pressure in mm Hg (mean of measurements). |
cct |
Numeric. Central Corneal Thickness in micrometers. |
vcdr |
Numeric. Vertical Cup-to-Disc Ratio (0.0 to 1.0). |
psd |
Numeric. Pattern Standard Deviation (dB) from visual field testing (Humphrey 24-2 or 30-2). |
Value
A list containing:
OHTS_Points |
The calculated total risk points (Range 0-13+). |
Five_Year_POAG_Risk |
The estimated percentage risk of developing POAG within 5 years. |
Risk_Category |
Classification of risk (Low, Intermediate, High). |
References
Gordon MO, Beiser JA, Brandt JD, et al. The Ocular Hypertension Treatment Study: baseline factors that predict the onset of primary open-angle glaucoma. Arch Ophthalmol. 2002;120(6):714-720. doi:10.1001/archopht.120.6.714 OHTS/EGPS Investigators. A Validated Prediction Model for the Development of Primary Open-Angle Glaucoma in Individuals with Ocular Hypertension. Ophthalmology. 2007;114(1):10-19.
Examples
# Example 1: Low Risk
# Age 45, IOP 21, CCT 600, VCDR 0.3, PSD 1.5
# Points: 0+0+0+0+0 = 0
ohts_risk_score(45, 21, 600, 0.3, 1.5)
# Example 2: High Risk
# Age 72, IOP 28, CCT 540, VCDR 0.7, PSD 2.8
# Points: 3+3+2+2+2 = 12
ohts_risk_score(72, 28, 540, 0.7, 2.8)
Opioid Conversion Calculator (Equianalgesic Dosing)
Description
Calculates the equianalgesic dose when switching from one opioid to another. The function converts the input dose to Morphine Milligram Equivalents (MME) and then converts to the target opioid dose, applying an optional percentage reduction for incomplete cross-tolerance.
Usage
opioid_conversion_calculator(current_drug, current_route, current_dose_mg,
target_drug, target_route, reduction_percent = 0)
Arguments
current_drug |
String. Name of the current opioid. Options: "morphine", "oxycodone", "hydrocodone", "hydromorphone", "codeine", "tramadol", "oxymorphone", "fentanyl". |
current_route |
String. Route of administration. Options: "po" (oral), "iv" (intravenous). |
current_dose_mg |
Numeric. The total dose of the current drug in milligrams. (Note: For Fentanyl IV, input must be in mg, e.g., 100 mcg = 0.1 mg). |
target_drug |
String. Name of the desired new opioid. |
target_route |
String. Route of the desired new opioid. |
reduction_percent |
Numeric. Percentage reduction to apply for incomplete cross-tolerance (e.g., 25 or 50). Defaults to 0. |
Details
Standard Equianalgesic Ratios used (relative to 1 mg PO Morphine): Morphine PO: 1 Morphine IV: 3 Oxycodone PO: 1.5 Hydrocodone PO: 1 Hydromorphone PO: 4 Hydromorphone IV: 20 Codeine PO: 0.15 Tramadol PO: 0.1 Fentanyl IV: 300 (based on mg input)
Value
A list containing:
Morphine_Milligram_Equivalents |
The unreduced MME of the input dose. |
Target_Dose_Calculated |
The estimated dose of the new drug after reduction. |
Reduction_Applied |
The percentage reduction used. |
References
McPherson ML. Demystifying Opioid Conversion Calculations: A Guide for Effective Dosing. Amer Soc of Health System; 2010.
Examples
# Example 1: 30mg PO Oxycodone to PO Morphine (No reduction)
# 30 * 1.5 = 45 MME
opioid_conversion_calculator("oxycodone", "po", 30, "morphine", "po")
# Example 2: 2mg IV Hydromorphone to PO Oxycodone with 25% reduction
# 2 * 20 = 40 MME. Reduce 25% = 30 MME. 30 / 1.5 = 20 mg Oxycodone.
opioid_conversion_calculator("hydromorphone", "iv", 2, "oxycodone", "po", 25)
Opioid Risk Tool (ORT) for Narcotic Abuse
Description
Calculates the Opioid Risk Tool (ORT) score to predict the probability of a patient displaying aberrant behaviors when prescribed opioids for chronic pain. The scoring algorithm assigns different point values to risk factors depending on the patient's sex.
Usage
opioid_risk_tool(sex, age, family_hx_alcohol, family_hx_illegal, family_hx_rx,
personal_hx_alcohol, personal_hx_illegal, personal_hx_rx,
history_sexual_abuse, psych_disease_adhd_ocd_bipolar_schizo,
psych_disease_depression)
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age |
Numeric. Patient age in years. (Age 16-45 adds 1 point for both sexes). |
family_hx_alcohol |
Numeric (0 or 1). Family history of alcohol abuse. (Female: +1, Male: +3). |
family_hx_illegal |
Numeric (0 or 1). Family history of illegal drug abuse. (Female: +2, Male: +3). |
family_hx_rx |
Numeric (0 or 1). Family history of prescription drug abuse. (Female: +4, Male: +4). |
personal_hx_alcohol |
Numeric (0 or 1). Personal history of alcohol abuse. (Female: +3, Male: +3). |
personal_hx_illegal |
Numeric (0 or 1). Personal history of illegal drug abuse. (Female: +4, Male: +4). |
personal_hx_rx |
Numeric (0 or 1). Personal history of prescription drug abuse. (Female: +5, Male: +5). |
history_sexual_abuse |
Numeric (0 or 1). History of preadolescent sexual abuse. (Female: +3, Male: 0). |
psych_disease_adhd_ocd_bipolar_schizo |
Numeric (0 or 1). Psychological disease (ADD, OCD, Bipolar, Schizophrenia). (Female: +2, Male: +2). |
psych_disease_depression |
Numeric (0 or 1). Psychological disease (Depression). (Female: +1, Male: +1). |
Value
A list containing:
ORT_Score |
The calculated total score (Range 0-26). |
Risk_Category |
Classification (Low <= 3, Moderate 4-7, High >= 8). |
References
Webster LR, Webster RM. Predicting aberrant behaviors in opioid-treated patients: preliminary validation of the Opioid Risk Tool. Pain Med. 2005;6(6):432-442. doi:10.1111/j.1526-4637.2005.00072.x
Examples
# Example 1: High Risk Male
# Fam Hx Alcohol (+3), Pers Hx Illegal (+4), Age 30 (+1)
# Score = 8
opioid_risk_tool("male", 30, 1, 0, 0, 0, 1, 0, 0, 0, 0)
# Example 2: Moderate Risk Female
# Fam Hx Alcohol (+1), Hx Sexual Abuse (+3)
# Score = 4
opioid_risk_tool("female", 50, 1, 0, 0, 0, 0, 0, 1, 0, 0)
Osteoporosis Risk Assessment Instrument (ORAI)
Description
Calculates the ORAI score to identify postmenopausal women at increased risk for osteoporosis who should be selected for Bone Mineral Density (BMD) testing. The score assigns points based on age, weight, and current estrogen use.
Usage
orai_osteoporosis_score(age, weight_kg, no_estrogen_therapy)
Arguments
age |
Numeric. Patient age in years. >=75: 15 pts. 65-74: 9 pts. 55-64: 5 pts. <55: 0 pts. |
weight_kg |
Numeric. Patient weight in kilograms. <60 kg: 9 pts. 60-69 kg: 3 pts. >=70 kg: 0 pts. |
no_estrogen_therapy |
Numeric (0 or 1). Is the patient NOT currently taking estrogen? (1 = Yes/No Estrogen, +2 pts). |
Value
A list containing:
ORAI_Score |
The calculated risk score (Range 0-26). |
Risk_Category |
Classification (Low Risk < 9, High Risk >= 9). |
Recommendation |
Guidance regarding BMD testing. |
References
Cadarette SM, Jaglal SB, Kreiger N, McIsaac WJ, Darlington GA, Tu JV. Development and validation of the Osteoporosis Risk Assessment Instrument to facilitate selection of women for bone densitometry. CMAJ. 2000;162(9):1289-1294.
Examples
# Example 1: High Risk
# 70yo (+9), 55kg (+9), No Estrogen (+2)
# Score = 20
orai_osteoporosis_score(70, 55, 1)
# Example 2: Low Risk
# 60yo (+5), 75kg (0), On Estrogen (0)
# Score = 5
orai_osteoporosis_score(60, 75, 0)
ORBIT Bleeding Risk Score for Atrial Fibrillation
Description
Calculates the ORBIT Bleeding Risk Score to predict major bleeding in patients with atrial fibrillation on oral anticoagulation. The score uses five clinical variables: Older age, Reduced hemoglobin/hematocrit/anemia, Bleeding history, Insufficient kidney function, and Treatment with antiplatelet agents.
Usage
orbit_bleeding_risk_score(age_gt_74, reduced_hemoglobin_or_hct_anemia,
bleeding_history, insufficient_kidney_function,
treatment_with_antiplatelet)
Arguments
age_gt_74 |
Numeric (0 or 1). Older Age (>74 years). (1 = Yes, +1 point). |
reduced_hemoglobin_or_hct_anemia |
Numeric (0 or 1). Reduced hemoglobin (<13 mg/dL for men, <12 mg/dL for women) or hematocrit (<40% for men, <36% for women) or history of anemia. (1 = Yes, +2 points). |
bleeding_history |
Numeric (0 or 1). Bleeding History (GI bleed, intracranial hemorrhage, or hemorrhagic stroke). (1 = Yes, +2 points). |
insufficient_kidney_function |
Numeric (0 or 1). Insufficient kidney function (eGFR <60 mg/dL/1.73 m^2). (1 = Yes, +1 point). |
treatment_with_antiplatelet |
Numeric (0 or 1). Treatment with antiplatelet agents. (1 = Yes, +1 point). |
Value
A list containing:
ORBIT_Score |
The calculated risk score (Range 0-7). |
Risk_Group |
Classification (Low: 0-2, Medium: 3, High: 4-7). |
Bleeding_Risk |
Estimated major bleeding rate per 100 patient-years. |
References
O'Brien EC, Simon DN, Thomas LE, et al. The ORBIT bleeding score: a simple bedside score to assess bleeding risk in atrial fibrillation. Eur Heart J. 2015;36(46):3258-3264. doi:10.1093/eurheartj/ehv476
Examples
# Example 1: High Risk
# Anemia (+2), Bleeding Hx (+2), Antiplatelet (+1)
# Score = 5
orbit_bleeding_risk_score(0, 1, 1, 0, 1)
# Example 2: Low Risk
# Age 70 (0), No other risk factors
# Score = 0
orbit_bleeding_risk_score(0, 0, 0, 0, 0)
Osteoporosis Index of Risk (OSIRIS)
Description
Calculates the OSIRIS score to stratify the risk of osteoporosis in postmenopausal women. The score utilizes four simple clinical variables: age, body weight, current hormone replacement therapy (HRT) use, and history of prior low-impact fracture. It aids in selecting women for Bone Mineral Density (BMD) testing.
Usage
osiris_osteoporosis_score(age, weight_kg, history_fracture, estrogen_therapy)
Arguments
age |
Numeric. Patient age in years. |
weight_kg |
Numeric. Patient weight in kilograms. |
history_fracture |
Numeric (0 or 1). History of previous low-impact fracture (e.g., wrist, spine, hip) occurring after age 45. (1 = Yes, -2 points). |
estrogen_therapy |
Numeric (0 or 1). Current use of Estrogen Replacement Therapy / Hormone Replacement Therapy (HRT). (1 = Yes, +2 points). |
Value
A list containing:
OSIRIS_Score |
The calculated index score. |
Risk_Category |
Classification (High Risk < 1, Medium Risk 1-3, Low Risk > 3). |
Recommendation |
Guidance regarding BMD testing. |
References
Sedrani O, et al. Accelerating the diagnosis of osteoporosis. The OSIRIS rule. (Osteoporosis Index of Risk). 2002.
Examples
# Example 1: High Risk
# 75yo, 50kg, Prior Fracture (+2 negative points), No HRT
# Base = (50-75)*0.2 = -5. Fx = -2. Total = -7.
osiris_osteoporosis_score(75, 50, 1, 0)
# Example 2: Low Risk
# 55yo, 70kg, No Fracture, On HRT (+2 positive points)
# Base = (70-55)*0.2 = 3. HRT = +2. Total = 5.
osiris_osteoporosis_score(55, 70, 0, 1)
Osteoporosis Self-Assessment Tool (OST) for Women
Description
Calculates the OST score to stratify the risk of osteoporosis in postmenopausal women using only age and weight. The tool was originally developed for Asian populations but has been validated in other cohorts to help select women for Bone Mineral Density (BMD) testing.
Usage
osteoporosis_self_assessment_tool(age, weight_kg)
Arguments
age |
Numeric. Patient age in years. |
weight_kg |
Numeric. Patient weight in kilograms. |
Value
A list containing:
OST_Score |
The calculated score (truncated integer). |
Risk_Category |
Classification (Low >1, Moderate -3 to 1, High < -3). |
Recommendation |
Guidance regarding BMD testing. |
References
Koh LK, Sedrani O, Lim SE, et al. A simple tool to identify Asian women at increased risk of osteoporosis. Osteoporos Int. 2001;12(8):699-705. doi:10.1007/s001980170070
Examples
# Example 1: High Risk
# 75yo, 45kg -> (45-75)*0.2 = -6
osteoporosis_self_assessment_tool(75, 45)
# Example 2: Low Risk
# 55yo, 70kg -> (70-55)*0.2 = 3
osteoporosis_self_assessment_tool(55, 70)
Ottawa Ankle Rule
Description
Calculates the Ottawa Ankle Rule to determine the need for radiography (X-ray) in patients with acute ankle or midfoot injuries. These rules are highly sensitive (nearly 100%) for detecting fractures, allowing clinicians to rule out fractures and reduce unnecessary imaging.
Usage
ottawa_ankle_rules(age, pain_malleolar_zone, pain_midfoot_zone,
tenderness_distal_tibia_fibula, tenderness_medial_malleolus,
tenderness_lateral_malleolus, tenderness_base_5th_metatarsal,
tenderness_navicular, inability_to_bear_weight)
Arguments
age |
Numeric. Patient age in years. (Rule applies broadly, though caution < 18 or > 55 in some protocols). |
pain_malleolar_zone |
Numeric (0 or 1). Pain in the malleolar zone? (1 = Yes). |
pain_midfoot_zone |
Numeric (0 or 1). Pain in the midfoot zone? (1 = Yes). |
tenderness_distal_tibia_fibula |
Numeric (0 or 1). Bone tenderness at the posterior edge or tip of the lateral or medial malleolus (distal 6cm)? (1 = Yes). Note: This covers the general distal tenderness criterion. |
tenderness_medial_malleolus |
Numeric (0 or 1). Specific tenderness at the posterior edge or tip of the medial malleolus? (1 = Yes). |
tenderness_lateral_malleolus |
Numeric (0 or 1). Specific tenderness at the posterior edge or tip of the lateral malleolus? (1 = Yes). |
tenderness_base_5th_metatarsal |
Numeric (0 or 1). Bone tenderness at the base of the 5th metatarsal? (1 = Yes). |
tenderness_navicular |
Numeric (0 or 1). Bone tenderness at the navicular? (1 = Yes). |
inability_to_bear_weight |
Numeric (0 or 1). Inability to bear weight both immediately after injury and in the emergency department (4 steps)? (1 = Yes). |
Value
A list containing:
Result |
Recommendation regarding the need for imaging. |
Imaging_Indicated |
Boolean flags for Ankle vs. Foot X-ray necessity. |
References
Stiell IG, Greenberg GH, McKnight RD, et al. Decision rules for the use of radiography in acute ankle injuries. Refinement and prospective validation. JAMA. 1993;269(9):1127-1132.
Examples
# Example 1: Ankle X-ray Indicated
# Pain in malleolar zone, tenderness at lateral malleolus
ottawa_ankle_rules(30, 1, 0, 0, 0, 1, 0, 0, 0)
# Example 2: Foot X-ray Indicated
# Pain in midfoot, tenderness at base of 5th metatarsal
ottawa_ankle_rules(45, 0, 1, 0, 0, 0, 1, 0, 0)
# Example 3: No X-ray
# Pain but no tenderness or weight bearing issues
ottawa_ankle_rules(25, 1, 1, 0, 0, 0, 0, 0, 0)
Ottawa COPD Risk Scale
Description
Calculates the Ottawa COPD Risk Scale score to predict the risk of short-term serious adverse events (SAEs) in patients presenting to the Emergency Department with acute exacerbation of COPD. SAEs include death, intubation, non-invasive ventilation, MI, or readmission.
Usage
ottawa_copd_risk_scale(history_copd, history_intubation, history_revascularization,
sa02_on_arrival, ecg_ischemia, antianginal_medication,
heart_rate_on_arrival, cxr_pulmonary_venous_congestion,
hemoglobin_on_arrival, bun_on_arrival)
Arguments
history_copd |
Numeric (0 or 1). Validated only for patients with COPD. |
history_intubation |
Numeric (0 or 1). History of intubation for respiratory distress. (1 = Yes, +2 pts). |
history_revascularization |
Numeric (0 or 1). History of coronary revascularization (CABG/PCI). (1 = Yes, +1 pt). |
sa02_on_arrival |
Numeric. Initial oxygen saturation on arrival (%). (< 92% adds 2 pts). |
ecg_ischemia |
Numeric (0 or 1). Evidence of acute ischemia on ECG. (1 = Yes, +2 pts). |
antianginal_medication |
Numeric (0 or 1). Use of antianginal medication (e.g., nitroglycerin). (1 = Yes, +1 pt). |
heart_rate_on_arrival |
Numeric. Initial heart rate (bpm). (>= 110 bpm adds 2 pts). |
cxr_pulmonary_venous_congestion |
Numeric (0 or 1). Pulmonary venous congestion on Chest X-ray. (1 = Yes, +2 pts). |
hemoglobin_on_arrival |
Numeric. Hemoglobin level on arrival (g/L). (< 100 g/L adds 3 pts). |
bun_on_arrival |
Numeric. Urea (BUN) level on arrival (mmol/L). (> 12 mmol/L adds 1 pt). |
Value
A list containing:
Ottawa_COPD_Risk_Score |
The calculated total score (Range 0-16). |
Risk_Short_Term_Adverse_Event |
Estimated percentage probability of an adverse event within 30 days. |
References
Stiell IG, Clement CM, Aaron SD, et al. Clinical characteristics associated with adverse events in patients with exacerbation of chronic obstructive pulmonary disease: a prospective cohort study. CMAJ. 2014;186(6):E193-204. doi:10.1503/cmaj.130968
Examples
# Example 1: High Risk
# Prior intubation (+2), Low SaO2 (+2), Tachycardia (+2), Low Hb (+3)
# Score = 9
ottawa_copd_risk_scale(1, 1, 0, 88, 0, 0, 120, 0, 90, 5)
# Example 2: Low Risk
# Only high BUN (+1)
# Score = 1
ottawa_copd_risk_scale(1, 0, 0, 95, 0, 0, 80, 0, 140, 15)
Ottawa Heart Failure Risk Scale (OHFRS)
Description
Calculates the Ottawa Heart Failure Risk Scale to predict the risk of serious adverse events (SAEs) within 14 days in patients with acute heart failure presenting to the emergency department. SAEs include death, admission to a monitored unit, intubation/NIV, MI, or relapse requiring admission.
Usage
ottawa_heart_failure_risk_scale(stroke_tia_history, intubation_history,
heart_rate_arrival, oxygen_sat_arrival,
heart_rate_walk_test, ecg_ischemia, urea_mmol_l,
co2_mmol_l, troponin_elevated, nt_probnp)
Arguments
stroke_tia_history |
Numeric (0 or 1). History of Stroke or TIA. (1 = Yes, +1 point). |
intubation_history |
Numeric (0 or 1). History of intubation for respiratory distress. (1 = Yes, +2 points). |
heart_rate_arrival |
Numeric. Heart rate on ED arrival. (>= 110 bpm adds 2 points). |
oxygen_sat_arrival |
Numeric. Oxygen saturation on arrival (%). (< 90% adds 1 point). |
heart_rate_walk_test |
Numeric. Heart rate during 3-minute walk test (or enter >=110 if too ill to walk). (>= 110 bpm adds 1 point). |
ecg_ischemia |
Numeric (0 or 1). New ischemic changes on ECG. (1 = Yes, +2 points). |
urea_mmol_l |
Numeric. Serum Urea (BUN) level in mmol/L. (>= 12 mmol/L adds 1 point). Note: 12 mmol/L approx 33.6 mg/dL BUN. |
co2_mmol_l |
Numeric. Serum CO2 (Bicarbonate) level in mmol/L. (>= 35 mmol/L adds 2 points). |
troponin_elevated |
Numeric (0 or 1). Troponin I or T elevated to MI levels. (1 = Yes, +2 points). |
nt_probnp |
Numeric. NT-proBNP level in ng/L (pg/mL). (>= 5000 ng/L adds 1 point). |
Value
A list containing:
OHFRS_Score |
The calculated risk score (Range 0-15). |
Risk_Category |
Classification (Low, Moderate, High, Very High). |
Risk_Serious_Adverse_Event_14d |
Estimated percentage probability of a serious adverse event within 14 days. |
References
Stiell IG, Clement CM, Brison RJ, et al. A risk scoring system to identify emergency department patients with heart failure at high risk for serious adverse events. Acad Emerg Med. 2013;20(1):17-26. doi:10.1111/acem.12056 Stiell IG, Perry JJ, Clement CM, et al. Prospective and Explicit Clinical Validation of the Ottawa Heart Failure Risk Scale, With and Without Use of Quantitative NT-proBNP. Acad Emerg Med. 2017;24(3):316-327. doi:10.1111/acem.13141
Examples
# Example 1: High Risk
# Prior Intubation (+2), HR 115 (+2), Trop High (+2), Urea 15 (+1), NT-proBNP 6000 (+1)
# Score = 8
ottawa_heart_failure_risk_scale(0, 1, 115, 95, 80, 0, 15, 25, 1, 6000)
# Example 2: Low Risk
# No history, Vitals stable, Labs normal
# Score = 0
ottawa_heart_failure_risk_scale(0, 0, 80, 98, 85, 0, 5, 24, 0, 400)
Ottawa Knee Rule
Description
Calculates the Ottawa Knee Rule to determine the need for knee radiography (X-ray) in patients with acute knee injury. The rule is highly sensitive for detecting fractures, allowing clinicians to safely rule out fractures without imaging if none of the criteria are met.
Usage
ottawa_knee_rule(age, isolated_patella_tenderness, fibula_head_tenderness,
inability_to_flex_90, inability_to_bear_weight)
Arguments
age |
Numeric. Patient age in years. (Age >= 55 is a positive criterion). |
isolated_patella_tenderness |
Numeric (0 or 1). Is there isolated tenderness of the patella (no bone tenderness of the knee other than the patella)? (1 = Yes). |
fibula_head_tenderness |
Numeric (0 or 1). Is there tenderness at the head of the fibula? (1 = Yes). |
inability_to_flex_90 |
Numeric (0 or 1). Is the patient unable to flex the knee to 90 degrees? (1 = Yes). |
inability_to_bear_weight |
Numeric (0 or 1). Is the patient unable to bear weight both immediately after the injury and in the emergency department (defined as taking 4 steps, even if limping)? (1 = Yes). |
Value
A list containing:
Result |
Recommendation regarding the need for X-ray ("Indicated" or "Not Indicated"). |
Reasoning |
List of specific criteria met that triggered the indication. |
Test_Characteristics |
Note on the sensitivity of the rule. |
References
Stiell IG, Greenberg GH, Wells GA, et al. Derivation of a decision rule for the use of radiography in acute knee injuries. Ann Emerg Med. 1995;26(4):405-413. doi:10.1016/s0196-0644(95)70106-0
Examples
# Example 1: X-ray Indicated (Age)
# 60yo, no other symptoms
# Result: Indicated
ottawa_knee_rule(60, 0, 0, 0, 0)
# Example 2: X-ray Indicated (Inability to flex)
# 30yo, Unable to flex to 90 degrees
# Result: Indicated
ottawa_knee_rule(30, 0, 0, 1, 0)
# Example 3: No X-ray
# 25yo, Minor pain, able to walk, full flexion, no bony tenderness
# Result: Not Indicated
ottawa_knee_rule(25, 0, 0, 0, 0)
Ottawa Subarachnoid Hemorrhage (SAH) Rule
Description
Calculates the Ottawa SAH Rule result for patients presenting with acute non-traumatic headache. This clinical decision rule has 100% sensitivity for subarachnoid hemorrhage, allowing clinicians to rule out SAH without further investigation (CT/LP) if all criteria are absent.
Usage
ottawa_sah_rule(age, neck_pain_stiffness, witnessed_loc, onset_exertion,
thunderclap_headache, limited_neck_flexion)
Arguments
age |
Numeric. Patient age in years. (>= 40 is a high-risk criterion). |
neck_pain_stiffness |
Numeric (0 or 1). Patient reports neck pain or stiffness? (1 = Yes). |
witnessed_loc |
Numeric (0 or 1). Was there witnessed loss of consciousness? (1 = Yes). |
onset_exertion |
Numeric (0 or 1). Did the headache start during exertion? (1 = Yes). |
thunderclap_headache |
Numeric (0 or 1). Was it a thunderclap headache (instantly peaking pain)? (1 = Yes). |
limited_neck_flexion |
Numeric (0 or 1). Is there limited neck flexion on physical examination? (1 = Yes). |
Value
A list containing:
Result |
Recommendation regarding the need for investigation (Investigate vs. Rule Out). |
Criteria_Met |
List of specific criteria that triggered a positive result. |
References
Perry JJ, Stiell IG, Sivilotti ML, et al. Clinical decision rules to rule out subarachnoid hemorrhage for acute headache. JAMA. 2013;310(12):1248-1255. doi:10.1001/jama.2013.278018
Examples
# Example 1: Investigate (Age >= 40)
# 45yo, No other symptoms
ottawa_sah_rule(45, 0, 0, 0, 0, 0)
# Example 2: Rule Out
# 30yo, No high risk features
ottawa_sah_rule(30, 0, 0, 0, 0, 0)
# Example 3: Investigate (Thunderclap)
# 25yo, Thunderclap headache
ottawa_sah_rule(25, 0, 0, 0, 1, 0)
Ongoing Violence Assessment Tool (OVAT)
Description
Calculates the OVAT score, a concise 4-item screening tool derived from the HITS index. It is designed specifically to identify ongoing (current) intimate partner violence in clinical settings. A "Yes" to any question constitutes a positive screen.
Usage
ovat_screening_tool(physically_hurt, threaten_harm, scream_curse,
insult_talk_down)
Arguments
physically_hurt |
Numeric (0 or 1). Has your partner physically hurt you? (1 = Yes). |
threaten_harm |
Numeric (0 or 1). Has your partner threatened you with harm? (1 = Yes). |
scream_curse |
Numeric (0 or 1). Has your partner screamed or cursed at you? (1 = Yes). |
insult_talk_down |
Numeric (0 or 1). Has your partner insulted or talked down to you? (1 = Yes). |
Value
A list containing:
OVAT_Score |
The calculated total score (Range 0-4). |
Screening_Result |
"Positive Screen" (Score >= 1) or "Negative Screen". |
Recommendation |
Clinical guidance based on the result. |
References
Ernst AA, Weiss SJ, Cham E, Hall LC, Nick TG. Ongoing Violence Assessment Tool (OVAT): development and validation of a new screening tool for identifying ongoing intimate partner violence. Acad Emerg Med. 2002;9(11):1383-1390.
Examples
# Example 1: Positive Screen
# Partner screams/curses (1), no physical harm (0)
ovat_screening_tool(0, 0, 1, 0)
# Example 2: Negative Screen
# No affirmative answers
ovat_screening_tool(0, 0, 0, 0)
Overall Neuropathy Limitations Scale (ONLS)
Description
Calculates the ONLS score to assess disability in patients with immune-mediated peripheral neuropathies (e.g., GBS, CIDP). The scale consists of an Arm Scale (0-5) and a Leg Scale (0-7), summed for a total score of 0-12.
Usage
overall_neuropathy_limitations_scale(arm_symptoms, wash_hair, turn_key,
use_knife, fasten_buttons, leg_symptoms,
walking_status)
Arguments
arm_symptoms |
Numeric (0 or 1). Does the patient have symptoms in hands or arms (e.g., tingling, numbness, weakness)? (1 = Yes). |
wash_hair |
Numeric (0, 1, or 2). Ability to wash and brush hair. 0: Normal, 1: Difficulty, 2: Impossible. |
turn_key |
Numeric (0, 1, or 2). Ability to turn a key in a lock. 0: Normal, 1: Difficulty, 2: Impossible. |
use_knife |
Numeric (0, 1, or 2). Ability to use a knife and fork together. 0: Normal, 1: Difficulty, 2: Impossible. |
fasten_buttons |
Numeric (0, 1, or 2). Ability to fasten buttons or zips. 0: Normal, 1: Difficulty, 2: Impossible. |
leg_symptoms |
Numeric (0 or 1). Does the patient have symptoms in legs or feet? (1 = Yes). |
walking_status |
String. Functional status of walking/running. "normal": No problems (Score 0 if no symptoms, 1 if symptoms). "symptoms_only": Symptoms present but walks/runs normally (Score 1). "difficulty_running": Difficulty running or abnormal gait but does not require support (Score 2). "difficulty_walking": Difficulty walking (gait abnormalities/reduced distance) but independent (Score 3). "unilateral_support": Uses 1 stick/cane/crutch (Score 4). "bilateral_support": Uses 2 sticks/crutches or a frame (Score 5). "wheelchair": Uses a wheelchair (Score 6). "bedbound": Restricted to bed (Score 7). |
Value
A list containing:
ONLS_Total_Score |
The calculated total score (Range 0-12). |
Arm_Scale_Score |
The arm subscore (0-5). |
Leg_Scale_Score |
The leg subscore (0-7). |
References
Graham RC, Hughes RA. A modified peripheral neuropathy scale: the Overall Neuropathy Limitations Scale. J Neurol Neurosurg Psychiatry. 2006;77(8):973-976. doi:10.1136/jnnp.2005.081547
Examples
# Example 1: Mild Disability
# Arm: Symptoms (1), Difficulty buttons (1) -> Score 2
# Leg: Difficulty running -> Score 2
# Total = 4
overall_neuropathy_limitations_scale(1, 0, 0, 0, 1, 1, "difficulty_running")
# Example 2: Severe Disability
# Arm: Cannot wash hair (2), Cannot buttons (2) -> Score 4 (2 impossible)
# Leg: Wheelchair -> Score 6
# Total = 10
overall_neuropathy_limitations_scale(1, 2, 0, 0, 2, 1, "wheelchair")
Oxygenation Index (OI)
Description
Calculates the Oxygenation Index (OI), a dimensionless number used primarily in neonatal and pediatric intensive care to assess the severity of hypoxic respiratory failure. It integrates Mean Airway Pressure (MAP) to quantify the intensity of ventilatory support required to maintain oxygenation. High values correlate with increased mortality and are used as criteria for advanced interventions like HFOV or ECMO.
Usage
oxygenation_index(mean_airway_pressure, fio2_percent, pao2)
Arguments
mean_airway_pressure |
Numeric. Mean Airway Pressure (MAP) in cm H2O. |
fio2_percent |
Numeric. Fraction of Inspired Oxygen as a percentage (e.g., 100 for 100% oxygen). |
pao2 |
Numeric. Partial pressure of arterial oxygen in mmHg. |
Details
The formula is:
OI = \frac{FiO_2 (\%) \times MAP}{PaO_2}
Common clinical thresholds:
OI > 25: High risk, consider HFOV/iNO.
OI > 40: Very high risk, consider ECMO.
Value
A list containing:
Oxygenation_Index |
The calculated OI value. |
Interpretation |
Clinical guidance based on standard severity thresholds. |
References
Ortiz RM, Cilley RE, Bartlett RH. Extracorporeal membrane oxygenation in pediatric respiratory failure. Pediatr Clin North Am. 1987;34(1):39-46. Trachsel D, McCrindle BW, Nakagawa S, Bohn D. Oxygenation index predicts mortality in children with acute hypoxemic respiratory failure. Am J Respir Crit Care Med. 2005;172(2):206-211. doi:10.1164/rccm.200405-625OC
Examples
# Example 1: Severe Failure (ECMO candidate)
# MAP 30, FiO2 100%, PaO2 60
# OI = (100 * 30) / 60 = 50
oxygenation_index(30, 100, 60)
# Example 2: Mild/Moderate
# MAP 15, FiO2 50%, PaO2 80
# OI = (50 * 15) / 80 = 9.38
oxygenation_index(15, 50, 80)
Pack Years Calculator
Description
Calculates the number of pack-years, a standard measure of cumulative cigarette smoking exposure. One pack-year is defined as smoking 20 cigarettes (one pack) per day for one year.
Usage
pack_years_calculator(packs_per_day = NULL, cigarettes_per_day = NULL, years_smoked)
Arguments
packs_per_day |
Numeric. The number of packs of cigarettes smoked per day. (Optional if cigarettes_per_day is provided). |
cigarettes_per_day |
Numeric. The number of individual cigarettes smoked per day. (Optional if packs_per_day is provided). |
years_smoked |
Numeric. The total number of years the patient has smoked. |
Details
Formula:
Pack Years = \frac{Cigarettes Per Day}{20} \times Years Smoked
OR
Pack Years = Packs Per Day \times Years Smoked
Value
A list containing:
Pack_Years |
The calculated pack-years value. |
References
Bernhardt PW, et al. Pack-years of smoking as a predictor of lung cancer.
Examples
# Example 1: Using packs per day
# 1.5 packs/day for 20 years
pack_years_calculator(packs_per_day = 1.5, years_smoked = 20)
# Example 2: Using cigarettes per day
# 10 cigarettes/day for 15 years
# 10/20 = 0.5 packs * 15 years = 7.5 pack-years
pack_years_calculator(cigarettes_per_day = 10, years_smoked = 15)
Padua Prediction Score for Risk of VTE
Description
Calculates the Padua Prediction Score to assess the risk of Venous Thromboembolism (VTE) in hospitalized medical patients. The score stratifies patients into low or high risk categories to guide thromboprophylaxis decisions.
Usage
padua_vte_score(active_cancer, previous_vte, reduced_mobility,
known_thrombophilia, recent_trauma_surgery, age,
heart_respiratory_failure, acute_mi_stroke,
infection_rheumatologic, bmi, hormonal_treatment)
Arguments
active_cancer |
Numeric (0 or 1). Active cancer (metastases and/or chemo/radiation in last 6 months). (1 = Yes, +3 points). |
previous_vte |
Numeric (0 or 1). Previous VTE (excluding superficial vein thrombosis). (1 = Yes, +3 points). |
reduced_mobility |
Numeric (0 or 1). Reduced mobility (bedrest with bathroom privileges for >= 3 days). (1 = Yes, +3 points). |
known_thrombophilia |
Numeric (0 or 1). Known thrombophilic condition. (1 = Yes, +3 points). |
recent_trauma_surgery |
Numeric (0 or 1). Recent (<= 1 month) trauma or surgery. (1 = Yes, +2 points). |
age |
Numeric. Patient age in years. (>= 70 years adds 1 point). |
heart_respiratory_failure |
Numeric (0 or 1). Heart or respiratory failure. (1 = Yes, +1 point). |
acute_mi_stroke |
Numeric (0 or 1). Acute myocardial infarction or ischemic stroke. (1 = Yes, +1 point). |
infection_rheumatologic |
Numeric (0 or 1). Acute infection or rheumatologic disorder. (1 = Yes, +1 point). |
bmi |
Numeric. Body Mass Index (kg/m^2). (>= 30 adds 1 point). |
hormonal_treatment |
Numeric (0 or 1). Ongoing hormonal treatment. (1 = Yes, +1 point). |
Value
A list containing:
Padua_Score |
The calculated total score (Range 0-20). |
Risk_Category |
Classification (Low Risk < 4, High Risk >= 4). |
Recommendation |
Clinical guidance regarding prophylaxis. |
References
Barbar S, Noventa F, Rossetto V, et al. A risk assessment model for the identification of hospitalized medical patients at risk for venous thromboembolism: the Padua Prediction Score. J Thromb Haemost. 2010;8(11):2450-2457. doi:10.1111/j.1538-7836.2010.04044.x
Examples
# Example 1: High Risk
# Cancer (+3), Recent Surgery (+2), Age 75 (+1)
# Score = 6
padua_vte_score(1, 0, 0, 0, 1, 75, 0, 0, 0, 25, 0)
# Example 2: Low Risk
# Infection (+1), BMI 32 (+1), Age 50 (0)
# Score = 2
padua_vte_score(0, 0, 0, 0, 0, 50, 0, 0, 1, 32, 0)
Pain Assessment in Advanced Dementia (PAINAD) Scale
Description
Calculates the PAINAD score, a tool designed to assess pain in patients with advanced dementia who cannot verbally communicate. The scale evaluates five behaviors: breathing, negative vocalization, facial expression, body language, and consolability. Each item is scored from 0 to 2, yielding a total score ranging from 0 to 10.
Usage
painad_score(breathing, negative_vocalization, facial_expression,
body_language, consolability)
Arguments
breathing |
Numeric (0-2). 0: Normal; 1: Occasional labored breathing/short hyperventilation; 2: Noisy labored breathing/long hyperventilation/Cheyne-Stokes. |
negative_vocalization |
Numeric (0-2). 0: None; 1: Occasional moan/groan/low-level negative speech; 2: Repeated troubled calling out/loud moaning/crying. |
facial_expression |
Numeric (0-2). 0: Smiling/inexpressive; 1: Sad/frightened/frown; 2: Facial grimacing. |
body_language |
Numeric (0-2). 0: Relaxed; 1: Tense/distressed pacing/fidgeting; 2: Rigid/fists clenched/knees pulled up/striking out. |
consolability |
Numeric (0-2). 0: No need to console; 1: Distracted/reassured by voice/touch; 2: Unable to console/distract/reassure. |
Value
A list containing:
PAINAD_Score |
The calculated total score (Range 0-10). |
Severity |
Interpretation of pain severity (No Pain, Mild, Moderate, Severe). |
References
Warden V, Hurley AC, Volicer L. Development and psychometric evaluation of the Pain Assessment in Advanced Dementia (PAINAD) scale. J Am Med Dir Assoc. 2003;4(1):9-15. doi:10.1093/geront/43.suppl_1.9
Examples
# Example 1: Moderate Pain
# Labored breathing (1), Moaning (1), Frown (1), Tense (1), Distractible (1)
# Score = 5
painad_score(1, 1, 1, 1, 1)
# Example 2: Severe Pain
# Noisy breathing (2), Crying (2), Grimacing (2), Rigid (2), Unable to console (2)
# Score = 10
painad_score(2, 2, 2, 2, 2)
Palchak (UC Davis) Rule for Pediatric Head Trauma
Description
Calculates the Palchak (UC Davis) Rule to identify children at low risk for traumatic brain injury (TBI) after blunt head trauma. The rule helps determine the need for head CT imaging. Children with none of the high-risk criteria are considered low risk and may be managed with observation.
Usage
palchak_pediatric_head_trauma_rule(abnormal_mental_status,
clinical_signs_skull_fracture,
history_vomiting,
scalp_hematoma_child_le_2y,
headache)
Arguments
abnormal_mental_status |
Numeric (0 or 1). Is there abnormal mental status (e.g., GCS < 15, agitation, somnolence, slow response, repetitive questioning)? (1 = Yes). |
clinical_signs_skull_fracture |
Numeric (0 or 1). Are there clinical signs of skull fracture (e.g., palpable fracture, hemotympanum, raccoon eyes, Battle's sign, CSF leak)? (1 = Yes). |
history_vomiting |
Numeric (0 or 1). Is there a history of vomiting? (1 = Yes). |
scalp_hematoma_child_le_2y |
Numeric (0 or 1). Is there a scalp hematoma in a child aged 2 years or younger? (1 = Yes). |
headache |
Numeric (0 or 1). Is there a history of headache? (1 = Yes). |
Value
A list containing:
Risk_Classification |
"High Risk" or "Low Risk". |
Recommendation |
Clinical guidance regarding the need for CT imaging. |
References
Palchak MJ, Holmes JF, Vance CW, et al. A decision rule for identifying children at low risk for brain injuries after blunt head trauma. Ann Emerg Med. 2003;42(4):492-506. doi:10.1016/s0196-0644(03)00463-7
Examples
# Example 1: Low Risk
# No symptoms or signs
palchak_pediatric_head_trauma_rule(0, 0, 0, 0, 0)
# Example 2: High Risk
# History of vomiting (1)
palchak_pediatric_head_trauma_rule(0, 0, 1, 0, 0)
Pancreatic Fistula Risk Score (PFRS)
Description
Calculates the Pancreatic Fistula Risk Score (based on Callery et al., 2013) to predict the development of a clinically relevant postoperative pancreatic fistula (POPF) after pancreatoduodenectomy. The score utilizes intraoperative variables: gland texture, pathology, pancreatic duct diameter, and estimated blood loss.
Usage
pancreatic_fistula_risk_score(gland_texture_soft,
pathology_is_adeno_or_pancreatitis,
duct_diameter_mm, blood_loss_ml)
Arguments
gland_texture_soft |
Numeric (0 or 1). Is the pancreatic gland texture soft? (1 = Yes, Soft [+2 pts]; 0 = No, Hard [0 pts]). |
pathology_is_adeno_or_pancreatitis |
Numeric (0 or 1). Is the pathology Pancreatic Adenocarcinoma or Chronic Pancreatitis? (1 = Yes [0 pts]; 0 = No [Other pathology like neuroendocrine, cystic, duodenal, ampullary adds +1 pt]). |
duct_diameter_mm |
Numeric. Diameter of the main pancreatic duct in millimeters. >= 5 mm: 0 pts. 4 mm: 1 pt. 3 mm: 2 pts. 2 mm: 3 pts. <= 1 mm: 4 pts. |
blood_loss_ml |
Numeric. Intraoperative blood loss in milliliters. <= 400 ml: 0 pts. 401-700 ml: 1 pt. 701-1000 ml: 2 pts. > 1000 ml: 3 pts. |
Value
A list containing:
Fistula_Risk_Score |
The calculated total score (Range 0-10). |
Risk_Category |
Classification (Negligible, Low, Intermediate, High). |
Est_Pancreatic_Fistula_Risk |
Estimated percentage risk of developing a Grade B or C fistula. |
References
Callery MP, Pratt WB, Kent TS, et al. A prospectively validated clinical risk score accurately predicts pancreatic fistula after pancreatoduodenectomy. J Am Coll Surg. 2013;216(1):1-14. doi:10.1016/j.jamcollsurg.2012.09.002
Examples
pancreatic_fistula_risk_score(
gland_texture_soft = 1,
pathology_is_adeno_or_pancreatitis = 0,
duct_diameter_mm = 2,
blood_loss_ml = 200
)
pancreatic_fistula_risk_score(
gland_texture_soft = 0,
pathology_is_adeno_or_pancreatitis = 1,
duct_diameter_mm = 6,
blood_loss_ml = 500
)
Positive and Negative Syndrome Scale (PANSS) for Schizophrenia
Description
Calculates the PANSS score, a comprehensive standard for assessing the severity of schizophrenia symptoms. It is divided into three subscales: Positive (P), Negative (N), and General Psychopathology (G). The total score ranges from 30 to 210.
Usage
panss_score(positive_scale_items, negative_scale_items,
general_psychopathology_items)
Arguments
positive_scale_items |
Numeric vector of length 7. Scores for items P1 through P7 (e.g., Delusions, Conceptual disorganization). Each item is scored 1 (Absent) to 7 (Extreme). |
negative_scale_items |
Numeric vector of length 7. Scores for items N1 through N7 (e.g., Blunted affect, Emotional withdrawal). Each item is scored 1 (Absent) to 7 (Extreme). |
general_psychopathology_items |
Numeric vector of length 16. Scores for items G1 through G16 (e.g., Somatic concern, Anxiety, Guilt feelings). Each item is scored 1 (Absent) to 7 (Extreme). |
Value
A list containing:
PANSS_Total_Score |
The sum of all 30 items (Range 30-210). |
Severity_Estimate |
Clinical impression based on Leucht et al. cutoffs. |
Subscales |
A list containing the individual sums for the Positive, Negative, and General subscales. |
References
Kay SR, Fiszbein A, Opler LA. The positive and negative syndrome scale (PANSS) for schizophrenia. Schizophr Bull. 1987;13(2):261-276. doi:10.1093/schbul/13.2.261 Leucht S, Kane JM, Kissling W, et al. What does the PANSS mean? Schizophr Res. 2005;79(2-3):231-238.
Examples
# Example 1: Moderate Severity
# P-scale (all 4s), N-scale (all 3s), G-scale (all 2s)
p_vec <- rep(4, 7)
n_vec <- rep(3, 7)
g_vec <- rep(2, 16)
# Total = 28 + 21 + 32 = 81
panss_score(p_vec, n_vec, g_vec)
# Example 2: Minimum Score (Absent symptoms)
p_min <- rep(1, 7)
n_min <- rep(1, 7)
g_min <- rep(1, 16)
# Total = 30
panss_score(p_min, n_min, g_min)
Paradise Criteria for Tonsillectomy in Children
Description
Evaluates the Paradise criteria to determine the appropriateness of tonsillectomy in children with recurrent throat infections. The criteria require a specific frequency of episodes over 1 to 3 years, and each episode must be characterized by specific clinical features (fever, lymphadenopathy, exudate, or positive GABHS) and treated with antibiotics.
Usage
paradise_criteria_tonsillectomy(episodes_past_12_months,
episodes_per_year_last_2_years,
episodes_per_year_last_3_years,
clinical_features_confirmed,
antibiotics_given_documented)
Arguments
episodes_past_12_months |
Numeric. Number of throat infection episodes in the past year. (Threshold: >= 7). |
episodes_per_year_last_2_years |
Numeric. Average number of throat infection episodes per year for the past 2 years. (Threshold: >= 5 per year). |
episodes_per_year_last_3_years |
Numeric. Average number of throat infection episodes per year for the past 3 years. (Threshold: >= 3 per year). |
clinical_features_confirmed |
Numeric (0 or 1). Did each episode include at least one of the following: Temperature > 38.3 C (100.9 F), cervical lymphadenopathy (>2cm or tender), tonsillar exudate, or positive GABHS culture? (1 = Yes). |
antibiotics_given_documented |
Numeric (0 or 1). Were the episodes treated with antibiotics and documented in clinical records? (1 = Yes). |
Value
A list containing:
Result |
Recommendation regarding tonsillectomy ("Criteria Met" or "Criteria Not Met"). |
References
Paradise JL, Bluestone CD, Bachman RZ, et al. Efficacy of tonsillectomy for recurrent throat infection in severely affected children. Results of parallel randomized and nonrandomized clinical trials. N Engl J Med. 1984;310(11):674-683. doi:10.1056/NEJM198403153101102
Examples
# Example 1: Criteria Met (7 in 1 year)
# 7 episodes, features present, documented
paradise_criteria_tonsillectomy(7, 0, 0, 1, 1)
# Example 2: Criteria Not Met (Frequency insufficient)
# 4 episodes in 1 year, features present
paradise_criteria_tonsillectomy(4, 0, 0, 1, 1)
# Example 3: Criteria Not Met (Clinical features missing)
# 8 episodes, but not characterized by fever/nodes/exudate
paradise_criteria_tonsillectomy(8, 0, 0, 0, 1)
Parkland Formula for Burn Resuscitation
Description
Calculates the fluid resuscitation requirements for burn patients within the first 24 hours of injury using the Parkland Formula. It determines the total volume of Lactated Ringer's solution required, split into the first 8 hours (50%) and the subsequent 16 hours (50%).
Usage
parkland_burn_formula(weight_kg, tbsa_percent)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. |
tbsa_percent |
Numeric. Total Body Surface Area burned as a percentage (e.g., enter 20 for 20%). |
Details
The formula used is:
Total\_Fluid (mL) = 4 \times Weight (kg) \times TBSA (\%)
Half of this total is administered in the first 8 hours from the time of injury, and the remaining half is administered over the next 16 hours.
Value
A list containing:
Total_Fluid_24h_mL |
Total estimated fluid requirement for the first 24 hours. |
First_8h_Volume_mL |
Volume to be administered in the first 8 hours. |
First_8h_Rate_mL_hr |
Infusion rate for the first 8 hours. |
Next_16h_Volume_mL |
Volume to be administered in the next 16 hours. |
Next_16h_Rate_mL_hr |
Infusion rate for the next 16 hours. |
References
Baxter CR, Shires T. Physiological response to crystalloid resuscitation of severe burns. Ann N Y Acad Sci. 1968;150(3):874-894. doi:10.1111/j.1749-6632.1968.tb14738.x
Examples
# Example 1: 75kg adult with 20% TBSA burn
# Total = 4 * 75 * 20 = 6000 mL
# First 8h = 3000 mL (375 mL/hr)
parkland_burn_formula(75, 20)
# Example 2: 50kg patient with 40% TBSA burn
# Total = 4 * 50 * 40 = 8000 mL
parkland_burn_formula(50, 40)
PFO-Associated Stroke Causal Likelihood (PASCAL) Classification
Description
Calculates the PASCAL classification to estimate the causal likelihood of a Patent Foramen Ovale (PFO) in a patient with cryptogenic stroke. This system integrates the RoPE Score with high-risk PFO anatomical features (large shunt or atrial septal aneurysm) to categorize the stroke-PFO relationship as Unlikely, Possible, or Probable.
Usage
pascal_classification_pfo(rope_score, high_risk_pfo_features)
Arguments
rope_score |
Numeric. The Risk of Paradoxical Embolism (RoPE) score (0-10). |
high_risk_pfo_features |
Numeric (0 or 1). Presence of high-risk PFO features, defined as a large shunt or an atrial septal aneurysm (ASA). (1 = Yes). |
Value
A list containing:
PASCAL_Classification |
The causal likelihood category (Unlikely, Possible, Probable). |
References
Kent DM, Saver JL, Kasner SE, et al. Heterogeneity of Treatment Effects in an Analysis of Pooled Individual Patient Data From Randomized Trials of Device Closure of Patent Foramen Ovale After Stroke. JAMA. 2021;326(22):2277–2286. doi:10.1001/jama.2021.20956
Examples
# Example 1: Probable (High RoPE + High Risk PFO)
pascal_classification_pfo(8, 1)
# Example 2: Possible (Low RoPE + High Risk PFO)
pascal_classification_pfo(4, 1)
# Example 3: Unlikely (Low RoPE + No High Risk Features)
pascal_classification_pfo(3, 0)
Psoriasis Area and Severity Index (PASI)
Description
Calculates the PASI score to assess the severity of psoriasis. The body is divided into four sections (Head, Arms, Trunk, Legs). Each section is scored for the severity of erythema, induration, and desquamation (0-4), and the percentage of area affected. The final score ranges from 0 to 72.
Usage
pasi_score(head_erythema, head_induration, head_desquamation, head_area_percent,
arms_erythema, arms_induration, arms_desquamation, arms_area_percent,
trunk_erythema, trunk_induration, trunk_desquamation, trunk_area_percent,
legs_erythema, legs_induration, legs_desquamation, legs_area_percent)
Arguments
head_erythema |
Numeric (0-4). Severity of redness on the head. |
head_induration |
Numeric (0-4). Severity of thickness on the head. |
head_desquamation |
Numeric (0-4). Severity of scaling on the head. |
head_area_percent |
Numeric (0-100). Percentage of head area affected. |
arms_erythema |
Numeric (0-4). Severity of redness on upper limbs. |
arms_induration |
Numeric (0-4). Severity of thickness on upper limbs. |
arms_desquamation |
Numeric (0-4). Severity of scaling on upper limbs. |
arms_area_percent |
Numeric (0-100). Percentage of upper limb area affected. |
trunk_erythema |
Numeric (0-4). Severity of redness on the trunk. |
trunk_induration |
Numeric (0-4). Severity of thickness on the trunk. |
trunk_desquamation |
Numeric (0-4). Severity of scaling on the trunk. |
trunk_area_percent |
Numeric (0-100). Percentage of trunk area affected. |
legs_erythema |
Numeric (0-4). Severity of redness on lower limbs. |
legs_induration |
Numeric (0-4). Severity of thickness on lower limbs. |
legs_desquamation |
Numeric (0-4). Severity of scaling on lower limbs. |
legs_area_percent |
Numeric (0-100). Percentage of lower limb area affected. |
Details
Severity Scores: 0: None 1: Mild 2: Moderate 3: Severe 4: Very Severe
Area Scoring (Internal Conversion): 0%: 0 <10%: 1 10-29%: 2 30-49%: 3 50-69%: 4 70-89%: 5 90-100%: 6
Value
A list containing:
PASI_Score |
The calculated total score. |
Interpretation |
General severity classification (Mild <=5, Moderate 5-10, Severe >10). |
Subscores |
Breakdown of weighted scores by body region. |
References
Fredriksson T, Pettersson U. Severe psoriasis–oral therapy with a new retinoid. Dermatologica. 1978;157(4):238-244. doi:10.1159/000250825
Examples
# Example 1: Severe Psoriasis
# Head: 2,2,2, 50% | Arms: 3,3,3, 60% | Trunk: 2,2,2, 40% | Legs: 4,4,4, 80%
pasi_score(2,2,2,50, 3,3,3,60, 2,2,2,40, 4,4,4,80)
# Example 2: Mild Psoriasis
# Head: 1,0,1, 5% | Arms: 1,1,0, 5% | Trunk: 0,0,0, 0% | Legs: 1,1,1, 10%
pasi_score(1,0,1,5, 1,1,0,5, 0,0,0,0, 1,1,1,10)
Patient Activity Scale-II (PAS-II) for Rheumatoid Arthritis
Description
Calculates the Patient Activity Scale-II (PAS-II), a patient-reported outcome measure for Rheumatoid Arthritis disease activity. It combines Pain VAS, Patient Global Assessment VAS, and the HAQ-II functional score into a single 0-10 scale.
Usage
patient_activity_scale_ii(pain_vas, patient_global_vas, haq_ii_items)
Arguments
pain_vas |
Numeric (0-10). Patient's assessment of pain on a 10 cm visual analog scale. |
patient_global_vas |
Numeric (0-10). Patient's global assessment of disease activity on a 10 cm visual analog scale. |
haq_ii_items |
Numeric vector of length 10. Scores for the 10 HAQ-II items (0=No difficulty, 1=Some difficulty, 2=Much difficulty, 3=Unable to do). Items cover: Standing up, Walking outdoors, Walking up steps, Washing, Reaching, Opening car door, Yard work, Waiting in line, Lifting heavy objects, Moving heavy objects. |
Value
A list containing:
PAS_II_Score |
The calculated score (Range 0-10). |
Disease_Activity |
Classification (Remission <= 0.25, Low <= 3.7, Moderate < 8.0, High >= 8.0). |
Components |
The individual weighted components used in the calculation. |
References
Anderson J, Caplan L, Yazdany J, et al. Rheumatoid arthritis disease activity measures: American College of Rheumatology recommendations for use in clinical practice. Arthritis Care Res (Hoboken). 2012;64(5):640-647. doi:10.1002/acr.21649
Examples
# Example 1: High Activity
# Pain 8, Global 9, HAQ-II mixed difficulty
haq_high <- c(2, 2, 3, 1, 3, 2, 3, 1, 3, 2)
patient_activity_scale_ii(8, 9, haq_high)
# Example 2: Low Activity
# Pain 2, Global 1, HAQ-II no difficulty
haq_low <- rep(0, 10)
patient_activity_scale_ii(2, 1, haq_low)
Patient Activity Scale (PAS) and PAS-II for Rheumatoid Arthritis
Description
Calculates the Patient Activity Scale (PAS) and PAS-II to assess disease activity in Rheumatoid Arthritis. These scores rely entirely on patient-reported outcomes: Pain VAS, Patient Global Assessment VAS, and the Health Assessment Questionnaire-II (HAQ-II).
Usage
patient_activity_scale_ra(pain_vas, patient_global_vas, haq_ii_items)
Arguments
pain_vas |
Numeric (0-10). Patient's assessment of pain on a visual analog scale. |
patient_global_vas |
Numeric (0-10). Patient's global assessment of disease activity on a visual analog scale. |
haq_ii_items |
Numeric vector of length 10. Scores for the 10 HAQ-II items (0=No difficulty, 1=Some difficulty, 2=Much difficulty, 3=Unable to do). Items include: 1. Stand up from a straight chair? 2. Walk outdoors on flat ground? 3. Walk up 5 steps? 4. Wash entire body? 5. Reach and get down a 5lb object from above head? 6. Open car door? 7. Do outside work (yard work)? 8. Wait in line for 15 minutes? 9. Lift heavy objects? 10. Move heavy objects? |
Value
A list containing:
PAS_Score |
The standard PAS score (Range 0-10). |
PAS_II_Score |
The PAS-II score (Range 0-10), often preferred for logarithmic scaling properties. |
Disease_Activity |
Classification (Remission <= 0.25, Low <= 3.7, Moderate < 8.0, High >= 8.0 based on PAS-II). |
References
Wolfe F, Michaud K, Pincus T. Development and validation of the health assessment questionnaire II: a revised version of the health assessment questionnaire. Arthritis Rheum. 2004;50(10):3296-3305. doi:10.1002/art.20549
Examples
# Example 1: High Activity
# Pain 8, Global 9, HAQ-II mostly 2s and 3s
haq_high <- c(2, 2, 3, 1, 3, 2, 3, 1, 3, 2)
patient_activity_scale_ra(8, 9, haq_high)
# Example 2: Remission
# Pain 0, Global 0, HAQ-II all 0
haq_low <- rep(0, 10)
patient_activity_scale_ra(0, 0, haq_low)
Prediction of Alcohol Withdrawal Severity Scale (PAWSS)
Description
Calculates the PAWSS score to screen hospitalized patients for the risk of developing complicated alcohol withdrawal syndrome (AWS), specifically seizures or delirium tremens. The scale consists of 10 items (Threshold criteria, Patient interview, and Clinical evidence), each worth 1 point.
Usage
pawss_score(recent_alcohol_use, bal_gt_200, previous_withdrawal,
previous_seizures, previous_dts, previous_rehab, blackouts,
concurrent_downer_use, concurrent_other_substance_use,
autonomic_hyperactivity)
Arguments
recent_alcohol_use |
Numeric (0 or 1). Has the patient consumed alcohol within the last 30 days OR was the patient intoxicated at presentation? (1 = Yes). |
bal_gt_200 |
Numeric (0 or 1). Is the blood alcohol level (BAL) > 200 mg/dL? (1 = Yes). |
previous_withdrawal |
Numeric (0 or 1). Has the patient experienced prior episodes of alcohol withdrawal? (1 = Yes). |
previous_seizures |
Numeric (0 or 1). Has the patient experienced prior withdrawal seizures? (1 = Yes). |
previous_dts |
Numeric (0 or 1). Has the patient experienced prior delirium tremens (DTs)? (1 = Yes). |
previous_rehab |
Numeric (0 or 1). Has the patient undergone previous alcohol rehabilitation treatment? (1 = Yes). |
blackouts |
Numeric (0 or 1). Has the patient experienced blackouts? (1 = Yes). |
concurrent_downer_use |
Numeric (0 or 1). Has the patient combined alcohol with benzodiazepines or barbiturates in the last 90 days? (1 = Yes). |
concurrent_other_substance_use |
Numeric (0 or 1). Has the patient combined alcohol with any other substance of abuse in the last 90 days? (1 = Yes). |
autonomic_hyperactivity |
Numeric (0 or 1). Is there clinical evidence of increased autonomic activity (e.g., HR > 120 bpm, tremor, sweating, agitation, nausea)? (1 = Yes). |
Value
A list containing:
PAWSS_Score |
The calculated total score (Range 0-10). |
Risk_Category |
Classification (Low Risk < 4, High Risk >= 4). |
Recommendation |
Clinical guidance regarding prophylaxis and monitoring. |
References
Maldonado JR, Sher Y, Ashouri JF, et al. The "Prediction of Alcohol Withdrawal Severity Scale" (PAWSS): systematic literature review and pilot study of a new scale for the prediction of complicated alcohol withdrawal syndrome. Alcohol. 2014;48(4):375-390. doi:10.1016/j.alcohol.2014.01.004
Examples
# Example 1: High Risk (Score >= 4)
# Recent use, Hx of Seizures, Hx of DTs, Autonomic signs
pawss_score(1, 0, 1, 1, 1, 0, 0, 0, 0, 1)
# Example 2: Low Risk (Score < 4)
# Recent use, Hx of Rehab, Blackouts
pawss_score(1, 0, 0, 0, 0, 1, 1, 0, 0, 0)
Indications for Paxlovid Prescribing
Description
Determines eligibility and appropriate dosing for Paxlovid (nirmatrelvir/ritonavir) therapy in patients with mild-to-moderate COVID-19. The function evaluates inclusion criteria (age, weight, risk factors, timing) and exclusion criteria (renal/hepatic impairment, drug interactions) based on FDA Emergency Use Authorization guidelines.
Usage
paxlovid_eligibility_check(covid_positive, symptom_onset_days, age_years,
weight_kg, has_risk_factors, egfr_ml_min,
severe_hepatic_impairment, significant_drug_interactions)
Arguments
covid_positive |
Numeric (0 or 1). Confirmed positive SARS-CoV-2 test. (1 = Yes). |
symptom_onset_days |
Numeric. Days since symptom onset. (Must be <= 5 days for eligibility). |
age_years |
Numeric. Patient age in years. (Must be >= 12 for eligibility). |
weight_kg |
Numeric. Patient weight in kilograms. (Must be >= 40 kg for eligibility). |
has_risk_factors |
Numeric (0 or 1). Does the patient have one or more risk factors for progression to severe COVID-19 (e.g., age >= 50, cancer, diabetes, obesity, cardiovascular disease)? (1 = Yes). |
egfr_ml_min |
Numeric. Estimated Glomerular Filtration Rate (mL/min). Used for dosing adjustment. (<30 is contraindicated). |
severe_hepatic_impairment |
Numeric (0 or 1). Presence of severe hepatic impairment (Child-Pugh Class C). (1 = Yes). |
significant_drug_interactions |
Numeric (0 or 1). Use of medications that are highly dependent on CYP3A for clearance or are potent CYP3A inducers, where interactions cannot be managed. (1 = Yes). |
Value
A list containing:
Status |
"Eligible" or "Not Eligible / Contraindicated". |
Recommendation |
Specific dosing instructions (Standard vs. Renal dose) or "None". |
Reason_for_Ineligibility |
Explanation if the patient is not eligible. |
References
FDA Fact Sheet for Healthcare Providers: Emergency Use Authorization for Paxlovid. U.S. Food and Drug Administration.
Examples
# Example 1: Eligible Standard Dose
# Positive, Day 3, 50yo, 80kg, Risk Factors, eGFR 90, No issues
paxlovid_eligibility_check(1, 3, 50, 80, 1, 90, 0, 0)
# Example 2: Eligible Renal Dose
# Positive, Day 4, 65yo, 70kg, Risk Factors, eGFR 45, No issues
paxlovid_eligibility_check(1, 4, 65, 70, 1, 45, 0, 0)
# Example 3: Contraindicated (eGFR)
# Positive, Day 2, 70yo, 70kg, Risk Factors, eGFR 20
paxlovid_eligibility_check(1, 2, 70, 70, 1, 20, 0, 0)
Peripheral Blood Stem Cell (PBSC) Collection Volume Calculator
Description
Calculates the total blood volume (in Liters) that must be processed through an apheresis machine to achieve a specific target yield of CD34+ stem cells. The calculation is based on the patient's weight, the pre-apheresis peripheral CD34+ cell count, and the estimated collection efficiency of the machine.
Usage
pbsc_collection_volume(weight_kg, pre_cd34_count, target_yield,
collection_efficiency_percent = 50)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. |
pre_cd34_count |
Numeric. Peripheral blood CD34+ cell count (cells/uL or cells/mm^3). |
target_yield |
Numeric. The desired CD34+ cell yield in millions of cells per kg (x 10^6/kg). Common targets range from 2 to 5 x 10^6/kg. |
collection_efficiency_percent |
Numeric. The estimated efficiency of the apheresis machine in collecting CD34+ cells (0-100). Defaults to 50%. Standard range is typically 30-50%. |
Details
The formula used is:
Volume (L) = \frac{Target Yield \times Weight}{CD34_{pre} \times Efficiency}
Where:
Target Yield is in
10^6cells/kg-
CD34_{pre}is in cells/\muL Efficiency is a decimal (Percent/100)
Note: The units cancel out such that the result is directly in Liters.
Value
A list containing:
Volume_to_Process_Liters |
The estimated blood volume to process to reach the target yield. |
References
Hester JP, et al. Stem Cell Collection. In: Apheresis: Principles and Practice. 3rd ed.
Examples
# Example 1: Standard Collection
# 70kg patient, CD34 count 20/uL, Target 5 million/kg, 50% efficiency
# Vol = (5 * 70) / (20 * 0.5) = 350 / 10 = 35 Liters
pbsc_collection_volume(70, 20, 5, 50)
# Example 2: High Efficiency, Low Count
# 80kg, CD34 10/uL, Target 2 million/kg, 40% efficiency
# Vol = (2 * 80) / (10 * 0.4) = 160 / 4 = 40 Liters
pbsc_collection_volume(80, 10, 2, 40)
Primary Care PTSD Screen for DSM-5 (PC-PTSD-5)
Description
Calculates the PC-PTSD-5 score, a 5-item screening tool designed for primary care settings to identify patients with probable PTSD. The tool first establishes exposure to a traumatic event, followed by 5 yes/no questions addressing core PTSD symptom clusters (re-experiencing, avoidance, hyperarousal, numbing, and guilt/blame).
Usage
pc_ptsd_5_screen(traumatic_event_exposure, nightmares_intrusive_thoughts,
avoidance, hyperarousal_startle, emotional_numbness, guilt_blame)
Arguments
traumatic_event_exposure |
Numeric (0 or 1). Has the patient been exposed to a traumatic event? (1 = Yes). This is a prerequisite for the remaining questions. |
nightmares_intrusive_thoughts |
Numeric (0 or 1). In the past month, have you had nightmares about the event or thought about it when you did not want to? (1 = Yes). |
avoidance |
Numeric (0 or 1). In the past month, have you tried hard not to think about the event or went out of your way to avoid situations that reminded you of it? (1 = Yes). |
hyperarousal_startle |
Numeric (0 or 1). In the past month, have you been constantly on guard, watchful, or easily startled? (1 = Yes). |
emotional_numbness |
Numeric (0 or 1). In the past month, have you felt numb or detached from people, activities, or your surroundings? (1 = Yes). |
guilt_blame |
Numeric (0 or 1). In the past month, have you felt guilty or unable to stop blaming yourself or others for the event or any problems the event may have caused? (1 = Yes). |
Value
A list containing:
PC_PTSD_5_Score |
The calculated total score (Range 0-5). |
Screening_Result |
"Positive Screen" (Score >= 3) or "Negative Screen". |
Recommendation |
Guidance for follow-up. |
References
Prins A, Bovin MJ, Smolenski DJ, et al. The Primary Care PTSD Screen for DSM-5 (PC-PTSD-5): Development and Evaluation Within a Veteran Primary Care Sample. J Gen Intern Med. 2016;31(10):1206-1211. doi:10.1007/s11606-016-3703-5
Examples
# Example 1: Positive Screen
# Trauma exposed (1), Nightmares (1), Avoidance (1), Startle (1), Numbness (0), Guilt (0)
# Score = 3
pc_ptsd_5_screen(1, 1, 1, 1, 0, 0)
# Example 2: Negative Screen
# Trauma exposed (1), Avoidance (1), No other symptoms
# Score = 1
pc_ptsd_5_screen(1, 0, 1, 0, 0, 0)
Pediatric Crohn's Disease Activity Index (PCDAI)
Description
Calculates the PCDAI score to assess disease activity in pediatric patients with Crohn's disease. The score ranges from 0 to 100, with higher scores indicating more active disease. It integrates subjective reporting, physical examination findings, and laboratory values (Hematocrit, ESR, Albumin).
Usage
pcdai_score(abdominal_pain_score, stool_frequency_score, general_wellbeing_score,
weight_score, height_score, abdominal_exam_score,
perirectal_disease_score, extraintestinal_manifestations_score,
hematocrit, esr, albumin_g_dl, age_years, sex)
Arguments
abdominal_pain_score |
Numeric. 0: None; 5: Mild; 10: Moderate/Severe. |
stool_frequency_score |
Numeric. 0: 0-1 liquid stools/day; 5: 2-5 liquid stools/day; 10: >=6 liquid stools/day or nocturnal. |
general_wellbeing_score |
Numeric. 0: No limitation; 5: Occasional limitation; 10: Frequent limitation. |
weight_score |
Numeric. 0: Weight gain or voluntary loss/stable; 5: Weight stable (if growing) or involuntary loss <10%; 10: Weight loss >=10%. |
height_score |
Numeric. 0: <1 channel decrease; 5: >=1 channel decrease; 10: >=2 channel decrease. |
abdominal_exam_score |
Numeric. 0: No tenderness/mass; 5: Tenderness or mass; 10: Tenderness/guarding or definite mass. |
perirectal_disease_score |
Numeric. 0: None/asymptomatic tags; 5: 1-2 indolent fistula/scant drainage/abscess; 10: Active fistula/drainage/tenderness/abscess. |
extraintestinal_manifestations_score |
Numeric. 0: None; 5: 1 manifestation; 10: >=2 manifestations (Fever >38.5C for 3 days, Arthritis, Uveitis, E. Nodosum, P. Gangrenosum, Stomatitis). |
hematocrit |
Numeric. Hematocrit percentage. |
esr |
Numeric. Erythrocyte Sedimentation Rate (mm/hr). |
albumin_g_dl |
Numeric. Serum Albumin (g/dL). |
age_years |
Numeric. Patient age in years (used for Hematocrit scoring). |
sex |
String. "Male" or "Female" (used for Hematocrit scoring). |
Value
A list containing:
PCDAI_Score |
The calculated total score. |
Disease_Activity |
Classification (Inactive <10, Mild 10-30, Moderate/Severe >30). |
Lab_Points |
Breakdown of points contributed by laboratory values. |
References
Hyams JS, et al. Development and validation of a pediatric Crohn's disease activity index. J Pediatr Gastroenterol Nutr. 1991;12(4):439-447.
Examples
# Example 1: Severe Disease
# Pain(10), Stool(10), Well(10), Wt(10), Ht(10), Abd(10), Peri(10), Extra(10),
# Low Hct (11y Male, Hct 30 -> 5pts), ESR 50 (5pts), Alb 2.5 (10pts)
pcdai_score(10, 10, 10, 10, 10, 10, 10, 10, 30, 50, 2.5, 11, "male")
# Example 2: Remission
# All 0s, Normal Labs
pcdai_score(0, 0, 0, 0, 0, 0, 0, 0, 40, 10, 4.0, 12, "female")
PE-SARD Bleeding Risk Score
Description
Calculates the PE-SARD (Pulmonary Embolism - Syncope, Anemia, Renal Dysfunction) Score to predict the risk of early major bleeding in patients with acute pulmonary embolism. The score stratifies patients into Low, Intermediate, and High risk groups.
Usage
pe_sard_bleeding_score(hemoglobin, syncope, egfr)
Arguments
hemoglobin |
Numeric. Hemoglobin level in g/dL. (<12 g/dL adds 2.5 points). |
syncope |
Numeric (0 or 1). History of syncope at presentation? (1 = Yes, +1.5 points). |
egfr |
Numeric. Estimated Glomerular Filtration Rate in mL/min/1.73m^2. (<60 mL/min adds 1 point). |
Value
A list containing:
PE_SARD_Score |
The calculated risk score (Range 0-5). |
Risk_Class |
Risk classification (Low: 0, Intermediate: 1-2.5, High: >2.5). |
Est_Major_Bleeding_Risk |
Estimated probability of early major bleeding. |
References
Chopard R, Piazza G, Falvo N, et al. An Original Risk Score to Predict Early Major Bleeding in Acute Pulmonary Embolism: The Syncope, Anemia, Renal Dysfunction (PE-SARD) Bleeding Score. Chest. 2021;160(5):1832-1843. doi:10.1016/j.chest.2021.06.048
Examples
# Example 1: High Risk
# Hb 11 (2.5), Syncope (1.5), eGFR 50 (1.0)
# Score = 5
pe_sard_bleeding_score(11, 1, 50)
# Example 2: Low Risk
# Hb 14 (0), No Syncope (0), eGFR 90 (0)
# Score = 0
pe_sard_bleeding_score(14, 0, 90)
PECARN Pediatric Cervical Spine Injury Risk Score
Description
Applies the PECARN decision rule to identify children at very low risk of clinically important cervical spine injury (CSI) after blunt trauma. The rule stratifies patients into High Risk (requiring CT), Intermediate Risk (requiring plain films or observation), and Low Risk (no imaging needed).
Usage
pecarn_c_spine_rule(gcs_score, altered_mental_status, focal_neurologic_deficit,
neck_pain, torticollis, substantial_torso_injury,
predisposing_condition, high_risk_mechanism)
Arguments
gcs_score |
Numeric. Glasgow Coma Scale score (3-15). (GCS < 15 is a high-risk factor). |
altered_mental_status |
Numeric (0 or 1). Presence of altered mental status (agitation, somnolence, repetitive questioning, or slow response to verbal questioning). (1 = Yes). |
focal_neurologic_deficit |
Numeric (0 or 1). Presence of focal neurologic deficit. (1 = Yes). |
neck_pain |
Numeric (0 or 1). Patient complains of neck pain. (1 = Yes). |
torticollis |
Numeric (0 or 1). Presence of torticollis (wry neck/stiff neck). (1 = Yes). |
substantial_torso_injury |
Numeric (0 or 1). Presence of substantial torso injury (e.g., seatbelt sign, chest/abdominal tenderness, or deformities). (1 = Yes). |
predisposing_condition |
Numeric (0 or 1). Presence of conditions predisposing to CSI (e.g., Trisomy 21, collagen vascular disease, prior cervical spine surgery/abnormality). (1 = Yes). |
high_risk_mechanism |
Numeric (0 or 1). High-risk mechanism of injury (e.g., diving, MVC, fall > 10ft/3m, axial load). (1 = Yes). |
Value
A list containing:
Risk_Level |
Classification (High Risk, Intermediate Risk, Low Risk). |
Recommendation |
Imaging guidance based on the risk level. |
References
Leonard JC, Kuppermann N, Olsen C, et al. Factors associated with cervical spine injury in children after blunt trauma. Ann Emerg Med. 2011;58(2):145-155. doi:10.1016/j.annemergmed.2010.08.038
Examples
# Example 1: High Risk (GCS 14)
pecarn_c_spine_rule(14, 0, 0, 0, 0, 0, 0, 1)
# Example 2: Intermediate Risk (Neck Pain only)
pecarn_c_spine_rule(15, 0, 0, 1, 0, 0, 0, 0)
# Example 3: Low Risk (No factors)
pecarn_c_spine_rule(15, 0, 0, 0, 0, 0, 0, 0)
PECARN Pediatric Head Injury/Trauma Algorithm
Description
Calculates the risk of clinically important Traumatic Brain Injury (ciTBI) in children with minor head trauma (GCS 14-15) using the PECARN prediction rules. The algorithm stratifies patients into Low, Intermediate, or High risk groups to guide the decision for head CT imaging versus observation. There are separate criteria for children < 2 years and those >= 2 years.
Usage
pecarn_head_injury_rule(age_years, gcs_score, altered_mental_status,
signs_of_skull_fracture, severe_mechanism_of_injury,
loc_duration_seconds = 0, not_acting_normally = 0,
non_frontal_scalp_hematoma = 0, history_of_vomiting = 0,
severe_headache = 0)
Arguments
age_years |
Numeric. Patient age in years. Determines which algorithm branch to use (<2 or >=2). |
gcs_score |
Numeric. Glasgow Coma Scale score. |
altered_mental_status |
Numeric (0 or 1). Agitation, somnolence, repetitive questioning, or slow response to verbal communication. (1 = Yes). |
signs_of_skull_fracture |
Numeric (0 or 1). Palpable fracture (if <2y) or signs of basilar skull fracture (if >=2y). (1 = Yes). |
severe_mechanism_of_injury |
Numeric (0 or 1). MVC with ejection/death/rollover, ped/bike vs auto, fall >3ft (<2y) or >5ft (>=2y), or head struck by high-impact object. (1 = Yes). |
loc_duration_seconds |
Numeric. Duration of loss of consciousness in seconds. (If > 0, counts as LOC history for >=2y. If > 5, counts as LOC criterion for <2y). |
not_acting_normally |
Numeric (0 or 1). [Only for < 2y] Is the child acting normally per parent? (1 = No/Not acting normally). |
non_frontal_scalp_hematoma |
Numeric (0 or 1). [Only for < 2y] Presence of non-frontal scalp hematoma. (1 = Yes). |
history_of_vomiting |
Numeric (0 or 1). [Only for >= 2y] History of vomiting. (1 = Yes). |
severe_headache |
Numeric (0 or 1). [Only for >= 2y] Severe headache. (1 = Yes). |
Value
A list containing:
Risk_Group |
Classification (Low, Intermediate, High). |
Risk_of_ciTBI |
Estimated risk of clinically important TBI. |
Recommendation |
Guidance on CT imaging vs. observation. |
References
Kuppermann N, Holmes JF, Dayan PS, et al. Identification of children at very low risk of clinically-important brain injuries after head trauma: a prospective cohort study. Lancet. 2009;374(9696):1160-1170. doi:10.1016/S0140-6736(09)61550-6
Examples
# Example 1: Child < 2 years, High Risk
# GCS 14, AMS
pecarn_head_injury_rule(1.5, 14, 1, 0, 0)
# Example 2: Child >= 2 years, Intermediate Risk
# 5yo, Vomiting, Normal GCS, No other signs
pecarn_head_injury_rule(5, 15, 0, 0, 0, history_of_vomiting = 1)
# Example 3: Child >= 2 years, Low Risk
# 8yo, No symptoms/signs
pecarn_head_injury_rule(8, 15, 0, 0, 0)
PECARN Pediatric Intra-Abdominal Injury (IAI) Algorithm
Description
Calculates the risk of Intra-Abdominal Injury (IAI) requiring acute intervention in children with blunt torso trauma using the PECARN prediction rule. The algorithm identifies patients at very low risk (<0.1%) who may safely forego abdominal CT imaging.
Usage
pecarn_pediatric_iai_algorithm(abdominal_wall_trauma_seatbelt_sign, gcs_lt_14,
abdominal_tenderness, thoracic_wall_trauma,
abdominal_pain, decreased_breath_sounds, vomiting)
Arguments
abdominal_wall_trauma_seatbelt_sign |
Numeric (0 or 1). Evidence of abdominal wall trauma or seatbelt sign (bruising, abrasion). (1 = Yes). |
gcs_lt_14 |
Numeric (0 or 1). Glasgow Coma Scale score < 14 (i.e., 13 or lower). (1 = Yes). |
abdominal_tenderness |
Numeric (0 or 1). Presence of abdominal tenderness on examination (mild, moderate, or severe). (1 = Yes). |
thoracic_wall_trauma |
Numeric (0 or 1). Evidence of thoracic wall trauma (pain, tenderness, contusion, abrasion). (1 = Yes). |
abdominal_pain |
Numeric (0 or 1). Patient complaint of abdominal pain. (1 = Yes). |
decreased_breath_sounds |
Numeric (0 or 1). Decreased or absent breath sounds on auscultation. (1 = Yes). |
vomiting |
Numeric (0 or 1). Any vomiting associated with the trauma. (1 = Yes). |
Value
A list containing:
PECARN_IAI_Risk_Factors |
The total count of positive predictors present. |
Risk_Category |
Classification (Very Low Risk vs. Not Very Low Risk). |
Risk_of_Intervention |
Estimated probability of IAI requiring acute intervention (laparotomy, angiographic embolization, blood transfusion, or IV fluids for >2 nights). |
References
Holmes JF, Lillis K, Monroe D, et al. Identifying children at very low risk of clinically important blunt abdominal injuries. Ann Emerg Med. 2013;62(2):107-116.e2. doi:10.1016/j.annemergmed.2012.11.009
Examples
# Example 1: Very Low Risk
# No symptoms or signs
pecarn_pediatric_iai_algorithm(0, 0, 0, 0, 0, 0, 0)
# Example 2: Not Very Low Risk
# Seatbelt sign (1), Abdominal pain (1)
# Score = 2
pecarn_pediatric_iai_algorithm(1, 0, 0, 0, 1, 0, 0)
PECARN Rule for Low-Risk Febrile Infants (29-60 Days)
Description
Applies the PECARN clinical prediction rule to identify febrile infants aged 29-60 days who are at very low risk for serious bacterial infections (SBI), including bacteremia, bacterial meningitis, and urinary tract infection. The rule uses three objective laboratory criteria.
Usage
pecarn_rule_febrile_infant_29_60_days(urinalysis_positive,
absolute_neutrophil_count, procalcitonin)
Arguments
urinalysis_positive |
Numeric (0 or 1). Is the urinalysis positive? Defined as positive leukocyte esterase, nitrite, or >5 WBC/hpf. (1 = Yes). |
absolute_neutrophil_count |
Numeric. The absolute neutrophil count (ANC) in cells/uL or /mm^3. (Low risk threshold: <= 4090). |
procalcitonin |
Numeric. Serum procalcitonin level in ng/mL. (Low risk threshold: <= 1.71). |
Details
The rule identifies infants as **Low Risk** if:
Urinalysis is negative
Absolute Neutrophil Count (ANC)
\le4090 cells/\muLSerum Procalcitonin
\le1.71 ng/mL
In the derivation/validation study, the sensitivity for SBI was very high (approx. 97.7-99.8%), with a high negative predictive value. It is specifically validated for well-appearing infants 29-60 days old with fever.
Value
A list containing:
Risk_Classification |
"Low Risk" or "Not Low Risk". |
Recommendation |
Clinical guidance regarding the need for further workup (e.g., LP) and admission. |
References
Kuppermann N, Dayan PS, Levine DA, et al. A Clinical Prediction Rule to Identify Febrile Infants 60 Days and Younger at Low Risk for Serious Bacterial Infections. JAMA Pediatr. 2019;173(4):342-351. doi:10.1001/jamapediatrics.2018.5501
Examples
# Example 1: Low Risk
# Neg UA, ANC 3000, PCT 0.2
pecarn_rule_febrile_infant_29_60_days(0, 3000, 0.2)
# Example 2: High Risk (Positive UA)
# Pos UA (1), ANC 3000, PCT 0.2
pecarn_rule_febrile_infant_29_60_days(1, 3000, 0.2)
# Example 3: High Risk (High PCT)
# Neg UA, ANC 3000, PCT 2.0
pecarn_rule_febrile_infant_29_60_days(0, 3000, 2.0)
Pediatric Appendicitis Risk Calculator (pARC)
Description
Calculates the Pediatric Appendicitis Risk Calculator (pARC) score to estimate the probability of appendicitis in children presenting with abdominal pain. The score utilizes sex, age, pain duration, pain migration, guarding, maximal tenderness in the right lower quadrant (RLQ), and absolute neutrophil count (ANC).
Usage
pediatric_appendicitis_risk_calculator(sex, age_years, pain_duration_hours,
abdominal_pain_migration, abdominal_guarding,
maximal_tenderness_rlq, absolute_neutrophil_count)
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age_years |
Numeric. Patient age in years. |
pain_duration_hours |
Numeric. Duration of abdominal pain in hours. |
abdominal_pain_migration |
Numeric (0 or 1). Migration of pain to the RLQ. (1 = Yes). |
abdominal_guarding |
Numeric (0 or 1). Presence of abdominal guarding on examination. (1 = Yes). |
maximal_tenderness_rlq |
Numeric (0 or 1). Is maximal tenderness located in the Right Lower Quadrant (RLQ)? (1 = Yes). |
absolute_neutrophil_count |
Numeric. Absolute Neutrophil Count (ANC) in x10^3/uL (or x10^9/L). |
Value
A list containing:
PARC_Score |
The calculated risk score (points). |
Appendicitis_Risk_Probability |
Estimated probability of appendicitis based on the score. |
References
Kharbanda AB, Vazquez-Benitez G, Ballard DW, et al. Development and Validation of a Pediatric Appendicitis Risk Calculator (pARC). Pediatrics. 2018;141(4):e20172699. doi:10.1542/peds.2017-2699
Examples
# Example 1: High Risk
# Male (+2), 10y (+7), Pain 36h (+4), Migration (+8), Guarding (+12),
#RLQ Tenderness (+16), ANC 15 (+49)
# Score = 98
pediatric_appendicitis_risk_calculator("male", 10, 36, 1, 1, 1, 15.0)
# Example 2: Low Risk
# Female (0), 4y (0), Pain 12h (0), No Migration, No Guarding, No RLQ Tenderness, ANC 5 (0)
# Score = 0
pediatric_appendicitis_risk_calculator("female", 4, 12, 0, 0, 0, 5.0)
Pediatric Appendicitis Score (PAS)
Description
Calculates the Pediatric Appendicitis Score (PAS), also known as the Samuel Score, to stratify the risk of acute appendicitis in children presenting with abdominal pain. The score ranges from 0 to 10 and categorizes patients into low, intermediate, or high risk groups.
Usage
pediatric_appendicitis_score(cough_hop_pain, anorexia, temperature_c,
nausea_vomiting, rlq_tenderness, wbc_count,
neutrophil_percent, migration_of_pain)
Arguments
cough_hop_pain |
Numeric (0 or 1). Presence of cough, percussion, or hopping tenderness in the right lower quadrant. (1 = Yes, +2 points). |
anorexia |
Numeric (0 or 1). Presence of anorexia. (1 = Yes, +1 point). |
temperature_c |
Numeric. Patient's body temperature in degrees Celsius. (> 38.0 C adds +1 point). |
nausea_vomiting |
Numeric (0 or 1). Presence of nausea or vomiting. (1 = Yes, +1 point). |
rlq_tenderness |
Numeric (0 or 1). Tenderness over the right iliac fossa (RLQ). (1 = Yes, +2 points). |
wbc_count |
Numeric. White blood cell count in cells/uL (e.g., 12000). (> 10,000 adds +1 point). |
neutrophil_percent |
Numeric. Percentage of neutrophils (polymorphonuclear neutrophilia). (> 75% adds +1 point). |
migration_of_pain |
Numeric (0 or 1). Migration of pain to the right lower quadrant (RLQ). (1 = Yes, +1 point). |
Value
A list containing:
PAS_Score |
The calculated total score (Range 0-10). |
Risk_Category |
Risk stratification (Low, Intermediate, High). |
Recommendation |
Clinical guidance based on the score. |
References
Samuel M. Pediatric appendicitis score. J Pediatr Surg. 2002;37(6):877-881. doi:10.1053/jpsu.2002.32893
Examples
# Example 1: High Risk
# Cough pain, RLQ tenderness, WBC 15k, Neutrophils 80%, Migration, Anorexia
# Score = 2 + 2 + 1 + 1 + 1 + 1 = 8
pediatric_appendicitis_score(1, 1, 37.5, 0, 1, 15000, 80, 1)
# Example 2: Low Risk
# Nausea only, normal labs
# Score = 1
pediatric_appendicitis_score(0, 0, 37.0, 1, 0, 8000, 50, 0)
Pediatric Asthma Score (PAS)
Description
Calculates the Pediatric Asthma Score (PAS), an objective assessment tool used to determine the severity of an acute asthma exacerbation in children. The score evaluates five clinical components: respiratory rate, oxygen requirement, retractions, dyspnea (speech/activity), and auscultation findings. The total score ranges from 5 to 15.
Usage
pediatric_asthma_score(age, respiratory_rate, oxygen_saturation,
on_supplemental_oxygen, retractions, dyspnea, auscultation)
Arguments
age |
Numeric. Patient age in years. Used to stratify respiratory rate scoring. |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. |
oxygen_saturation |
Numeric. Oxygen saturation (SpO2) percentage (0-100). |
on_supplemental_oxygen |
Numeric (0 or 1). Is the patient currently receiving supplemental oxygen? (1 = Yes). Note: Being on oxygen automatically assigns the maximum points (3) for the oxygen component. |
retractions |
String. Severity of retractions. "none_intercostal": Normal to Intercostal retractions (1 pt). "substernal_suprasternal": Substernal or Suprasternal retractions (2 pts). "supraclavicular_flaring": Supraclavicular retractions, nasal flaring, or head bobbing (3 pts). |
dyspnea |
String. Speech or activity level limitations. "sentences": Counts to 10, speaks in sentences, or normal activity (1 pt). "phrases": Counts to 7, speaks in partial phrases, or decreased activity (2 pts). "words": Counts to 3, speaks in single words, or minimal activity (3 pts). |
auscultation |
String. Breath sounds. "end_expiratory": Normal breath sounds or end-expiratory wheeze only (1 pt). "throughout": Expiratory wheezing > 50% of exhalation +/- inspiratory wheezing (2 pts). "diminished": Diminished or absent breath sounds (silent chest) (3 pts). |
Value
A list containing:
PAS_Score |
The calculated total score (Range 5-15). |
Severity |
Clinical severity classification (Mild 5-7, Moderate 8-11, Severe 12-15). |
Subscores |
Breakdown of points assigned for each of the five components. |
References
Schuh S, et al. Efficacy of frequent nebulized ipratropium bromide added to frequent high-dose albuterol therapy in severe childhood asthma. J Pediatr. 1995;126(4):639-645.
Examples
# Example 1: Moderate Exacerbation
# 6yo, RR 30 (2 pts), SpO2 92% (2 pts), Substernal retractions (2 pts),
# Phrases (2 pts), Throughout wheeze (2 pts)
# Score = 10
pediatric_asthma_score(6, 30, 92, 0, "substernal_suprasternal", "phrases", "throughout")
# Example 2: Mild Exacerbation
# 10yo, RR 20 (1 pt), SpO2 98% (1 pt), No retractions (1 pt),
# Sentences (1 pt), End-exp wheeze (1 pt)
# Score = 5
pediatric_asthma_score(10, 20, 98, 0, "none_intercostal", "sentences", "end_expiratory")
Pediatric Asthma Severity Score (PASS)
Description
Calculates the Pediatric Asthma Severity Score (PASS), a clinical tool used to assess the severity of asthma exacerbations in children (ages 1-18). The score evaluates three physical exam findings: wheezing, work of breathing, and prolongation of expiration. Scores correlate with the decision to admit or discharge.
Usage
pediatric_asthma_severity_score(wheezing, work_of_breathing, prolongation_of_expiration)
Arguments
wheezing |
String. Severity of wheezing. "normal_mild": None or mild (0 pts). "moderate": Moderate (1 pt). "severe": Severe wheezing or absent breath sounds due to poor air movement (2 pts). |
work_of_breathing |
String. Use of accessory muscles and retractions. "normal_mild": Normal or mildly increased (0 pts). "moderate": Moderate (1 pt). "severe": Severe (2 pts). |
prolongation_of_expiration |
String. Ratio of expiration to inspiration. "normal_mild": Normal or mildly prolonged (0 pts). "moderate": Moderately prolonged (1 pt). "severe": Severely prolonged (2 pts). |
Value
A list containing:
PASS_Score |
The calculated total score (Range 0-6). |
Interpretation |
Clinical guidance based on the score (Score < 2 suggests discharge; >= 2 suggests need for further observation or admission). |
References
Gorelick MH, Scribano PV, Stevens MW, et al. Predicting admission in children with acute asthma. Pediatr Emerg Care. 2008;24(11):735-744. doi:10.1097/PEC.0b013e31818c26e2
Examples
# Example 1: Mild Exacerbation
# Mild wheeze (0), Moderate work (1), Normal expiration (0)
# Score = 1
pediatric_asthma_severity_score("normal_mild", "moderate", "normal_mild")
# Example 2: Severe Exacerbation
# Severe wheeze (2), Severe work (2), Severe expiration (2)
# Score = 6
pediatric_asthma_severity_score("severe", "severe", "severe")
Pediatric Trauma BIG Score
Description
Calculates the BIG Score (Base deficit, INR, Glasgow coma scale) to predict in-hospital mortality in pediatric trauma patients. This rapid stratification tool uses admission laboratory and clinical values to identify children with a high risk of death.
Usage
pediatric_big_score(base_deficit, inr, gcs)
Arguments
base_deficit |
Numeric. Admission base deficit in mmol/L (or mEq/L). Enter as a positive value representing the deficit (e.g., if Base Excess is -10, enter 10). |
inr |
Numeric. Admission International Normalized Ratio. |
gcs |
Numeric. Admission Glasgow Coma Scale score (3-15). |
Value
A list containing:
BIG_Score |
The calculated score. |
Risk_Category |
Risk stratification based on the threshold of 16. |
Mortality_Prediction |
Estimated mortality risk category. |
References
Borgman MA, Maegele M, Spinella PC, et al. Patient-specific predictive model for in-hospital mortality in children with traumatic injuries. Pediatrics. 2011;127(3):e689-696. doi:10.1542/peds.2010-1257
Examples
# Example 1: Low Risk
# Base Deficit 2, INR 1.1, GCS 15
# Score = 2 + (2.5 * 1.1) + (15 - 15) = 2 + 2.75 + 0 = 4.75
pediatric_big_score(2, 1.1, 15)
# Example 2: High Risk
# Base Deficit 10, INR 1.8, GCS 8
# Score = 10 + (2.5 * 1.8) + (15 - 8) = 10 + 4.5 + 7 = 21.5
pediatric_big_score(10, 1.8, 8)
Pediatric Endotracheal Tube (ETT) Size Calculator
Description
Calculates the recommended internal diameter (ID) for uncuffed and cuffed endotracheal tubes for pediatric patients based on age. Also estimates the depth of insertion. This function typically uses the Cole formula for children older than 1 year.
Usage
pediatric_ett_size(age_years)
Arguments
age_years |
Numeric. Age of the child in years. |
Details
The standard formulas used for children \ge 1 year are:
-
Uncuffed Size (mm ID):
(Age / 4) + 4 -
Cuffed Size (mm ID):
(Age / 4) + 3.5 -
Depth (cm):
(Age / 2) + 12
For infants (< 1 year), fixed sizes (3.5mm uncuffed for <6mo, 4.0mm for 6mo-1yr) are generally recommended.
Value
A list containing:
Uncuffed_ETT_Size_mm |
Recommended internal diameter for an uncuffed tube. |
Cuffed_ETT_Size_mm |
Recommended internal diameter for a cuffed tube. |
Depth_of_Insertion_cm |
Estimated depth of insertion at the lip. |
References
Cole F. Pediatric formulas for the anesthesiologist. AMA J Dis Child. 1957;94(6):672-673. Standard PALS Guidelines (AHA).
Examples
# Example 1: 4-year-old child
# Uncuffed: 4/4 + 4 = 5.0 mm
# Cuffed: 4/4 + 3.5 = 4.5 mm
# Depth: 4/2 + 12 = 14 cm
pediatric_ett_size(4)
# Example 2: 8-year-old child
# Uncuffed: 8/4 + 4 = 6.0 mm
# Cuffed: 8/4 + 3.5 = 5.5 mm
# Depth: 8/2 + 12 = 16 cm
pediatric_ett_size(8)
Pediatric Glasgow Coma Scale (pGCS)
Description
Calculates the Pediatric Glasgow Coma Scale score, used to assess the level of consciousness in children, particularly those who are pre-verbal (< 2 years). The scale evaluates three components: Eye opening, Verbal response, and Motor response.
Usage
pediatric_glasgow_coma_scale(eye_response, verbal_response, motor_response)
Arguments
eye_response |
Numeric (1-4). 4: Spontaneous. 3: To speech/sound. 2: To pain. 1: None. |
verbal_response |
Numeric (1-5). 5: Coos, babbles (or Oriented). 4: Irritable cry (or Confused). 3: Cries to pain (or Inappropriate words). 2: Moans to pain (or Incomprehensible sounds). 1: None. |
motor_response |
Numeric (1-6). 6: Spontaneous movement (or Obeys commands). 5: Withdraws to touch (or Localizes pain). 4: Withdraws from pain. 3: Abnormal flexion (decorticate). 2: Abnormal extension (decerebrate). 1: None/Flaccid. |
Value
A list containing:
pGCS_Score |
The calculated total score (Range 3-15). |
Severity_Classification |
Interpretation of traumatic brain injury severity (Mild, Moderate, Severe). |
References
Teasdale G, Jennett B. Assessment of coma and impaired consciousness. A practical scale. Lancet. 1974;2(7872):81-84. Simpson D, Reilly P. Pediatric Coma Scale. Lancet. 1982;2(8295):450.
Examples
# Example 1: Normal Infant
# Eyes spontaneous (4), Coos/babbles (5), Spontaneous moves (6)
pediatric_glasgow_coma_scale(4, 5, 6)
# Example 2: Severe Injury
# Eyes to pain (2), Moans (2), Decerebrate (2)
pediatric_glasgow_coma_scale(2, 2, 2)
Pediatric Ins and Outs (Maintenance Fluids and Urine Output)
Description
Calculates the maintenance fluid requirements using the Holliday-Segar (4-2-1) Rule and estimates the target urine output based on the child's weight. This provides a guideline for fluid management and monitoring renal function in pediatric patients.
Usage
pediatric_ins_outs(weight_kg)
Arguments
weight_kg |
Numeric. The patient's weight in kilograms. |
Details
Maintenance Fluids (4-2-1 Rule):
0-10 kg: 4 mL/kg/hr
10-20 kg: 40 mL/hr + 2 mL/kg/hr for every kg above 10
>20 kg: 60 mL/hr + 1 mL/kg/hr for every kg above 20
Target Urine Output (Estimates):
Infants/Young Children: ~1-2 mL/kg/hr
Children: ~1 mL/kg/hr
Adolescents: ~0.5-1 mL/kg/hr
Value
A list containing:
Maintenance_Rate_mL_hr |
The calculated hourly maintenance fluid rate. |
Maintenance_Volume_24h_mL |
The total daily maintenance fluid volume. |
Target_Urine_Output_mL_hr |
The estimated range for adequate urine output in mL/hr. |
Target_Description |
The specific rate standard used based on weight. |
References
Holliday MA, Segar WE. The maintenance need for water in parenteral fluid therapy. Pediatrics. 1957;19(5):823-832.
Examples
# Example 1: 8 kg Infant
# Maint = 32 mL/hr, UO Target 8-16 mL/hr
pediatric_ins_outs(8)
# Example 2: 15 kg Child
# Maint = 40 + (5*2) = 50 mL/hr, UO Target 15-22.5 mL/hr
pediatric_ins_outs(15)
# Example 3: 50 kg Adolescent
# Maint = 60 + (30*1) = 90 mL/hr, UO Target 25-50 mL/hr
pediatric_ins_outs(50)
Pediatric NEXUS II Head CT Decision Instrument
Description
Calculates the Pediatric NEXUS II result to determine the necessity of a head CT scan in children with blunt head trauma. The rule identifies patients at low risk for clinically important intracranial injury who may be safely managed without imaging. If any of the seven criteria are present, imaging is generally indicated.
Usage
pediatric_nexus_ii_head_ct(skull_fracture_evidence, scalp_hematoma,
neurologic_deficit, altered_alertness,
abnormal_behavior, coagulopathy, persistent_vomiting)
Arguments
skull_fracture_evidence |
Numeric (0 or 1). Evidence of significant skull fracture (e.g., palpable depression, basilar signs). (1 = Yes). |
scalp_hematoma |
Numeric (0 or 1). Presence of scalp hematoma. (1 = Yes). |
neurologic_deficit |
Numeric (0 or 1). Presence of neurologic deficit. (1 = Yes). |
altered_alertness |
Numeric (0 or 1). Altered level of alertness (GCS < 15). (1 = Yes). |
abnormal_behavior |
Numeric (0 or 1). Abnormal behavior present (e.g., agitation, somnolence, refusal to eat). (1 = Yes). |
coagulopathy |
Numeric (0 or 1). Presence of coagulopathy (history of bleeding disorder or anticoagulation). (1 = Yes). |
persistent_vomiting |
Numeric (0 or 1). Persistent vomiting. (1 = Yes). |
Value
A list containing:
Result |
Recommendation regarding the need for Head CT ("Indicated" or "Not Indicated"). |
Inputs |
A summary of the criteria evaluated. |
References
Mower WR, Hoffman JR, Herbert M, et al. Developing a decision instrument to guide computed tomographic imaging of blunt head injury patients. J Trauma. 2005;59(4):954-959.
Examples
# Example 1: Low Risk
# No findings
pediatric_nexus_ii_head_ct(0, 0, 0, 0, 0, 0, 0)
# Example 2: CT Indicated (Hematoma)
# Scalp hematoma present
pediatric_nexus_ii_head_ct(0, 1, 0, 0, 0, 0, 0)
Pediatric NIH Stroke Scale (PedNIHSS)
Description
Calculates the Pediatric NIH Stroke Scale (PedNIHSS) score. This is a validated adaptation of the standard NIHSS for use in children, using age-appropriate stimuli and instructions to assess neurological deficits in acute stroke. The scoring values (0 to 4) for each domain remain consistent with the adult scale.
Usage
pediatric_nih_stroke_scale(loc_responsiveness, loc_questions, loc_commands, gaze,
visual_fields, facial_palsy, motor_arm_left,
motor_arm_right, motor_leg_left, motor_leg_right,
limb_ataxia, sensory, best_language, dysarthria,
extinction_inattention)
Arguments
loc_responsiveness |
Numeric (0-3). 1a: Level of Consciousness (0=Alert, 3=Coma). |
loc_questions |
Numeric (0-2). 1b: LOC Questions (Age appropriate, e.g., month/age). (0=Both correct, 2=Neither correct). |
loc_commands |
Numeric (0-2). 1c: LOC Commands (Open/close eyes, grip hand). (0=Both correct, 2=Neither correct). |
gaze |
Numeric (0-2). 2: Best Gaze. (0=Normal, 2=Forced deviation). |
visual_fields |
Numeric (0-3). 3: Visual Fields. (0=No visual loss, 3=Bilateral hemianopia). |
facial_palsy |
Numeric (0-3). 4: Facial Palsy. (0=Normal, 3=Complete paralysis). |
motor_arm_left |
Numeric (0-4). 5a: Motor Arm Left. (0=No drift, 4=No movement). |
motor_arm_right |
Numeric (0-4). 5b: Motor Arm Right. |
motor_leg_left |
Numeric (0-4). 6a: Motor Leg Left. (0=No drift, 4=No movement). |
motor_leg_right |
Numeric (0-4). 6b: Motor Leg Right. |
limb_ataxia |
Numeric (0-2). 7: Limb Ataxia. (0=Absent, 2=Present in two limbs). |
sensory |
Numeric (0-2). 8: Sensory. (0=Normal, 2=Severe loss). |
best_language |
Numeric (0-3). 9: Best Language. (0=No aphasia, 3=Mute/Global aphasia). |
dysarthria |
Numeric (0-2). 10: Dysarthria. (0=Normal, 2=Severe). |
extinction_inattention |
Numeric (0-2). 11: Extinction and Inattention (Neglect). (0=No abnormality, 2=Profound hemi-inattention). |
Value
A list containing:
PedNIHSS_Score |
The calculated total score (Range 0-42). |
Severity_Level |
Interpretation of stroke severity (No Symptoms, Minor, Moderate, Moderate-Severe, Severe). |
References
Beslow LA, Jordan LC. Pediatric Stroke: The Importance of Time and Team. Stroke. 2016. Williams LS, Yilmaz EY, Lopez-Yunez AM. Retrospective assessment of initial stroke severity with the NIH Stroke Scale. Stroke. 2000;31(4):858-862.
Examples
# Example 1: Moderate Stroke
# Drowsy(1), Partial Gaze(1), Facial Droop(2), Arm Drift(1), Mild Aphasia(1)
pediatric_nih_stroke_scale(1, 0, 0, 1, 0, 2, 1, 0, 0, 0, 0, 0, 1, 0, 0)
# Example 2: Severe Stroke
# Stuporous(2), Forced Gaze(2), Hemianopia(2), R-sided Paralysis(4,4), Global Aphasia(3), Neglect(2)
pediatric_nih_stroke_scale(2, 2, 0, 2, 2, 2, 0, 4, 0, 4, 0, 0, 3, 2, 2)
Pediatric SIRS, Sepsis, and Septic Shock Criteria
Description
Evaluates the 2005 International Pediatric Sepsis Consensus Conference criteria for SIRS, Sepsis, Severe Sepsis, and Septic Shock. The calculation uses age-specific thresholds for heart rate, respiratory rate, and leukocyte count.
Usage
pediatric_sepsis_criteria(age_category, temp_c, heart_rate, respiratory_rate,
wbc_count, bands_percent, infection_suspected,
cardiovascular_dysfunction, ards_present,
multiple_organ_dysfunction)
Arguments
age_category |
String. One of: "newborn_0_7d", "neonate_1w_1m", "infant_1m_1y", "child_2y_5y", "child_6y_12y", "adolescent_13y_18y". |
temp_c |
Numeric. Core temperature in degrees Celsius. (Abnormal: >38.5 or <36.0). |
heart_rate |
Numeric. Heart rate in beats per minute. |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. |
wbc_count |
Numeric. White Blood Cell count in x10^3/mm^3. |
bands_percent |
Numeric. Percentage of immature neutrophils (bands). (Abnormal: >10%). |
infection_suspected |
Numeric (0 or 1). Is there a suspected or proven infection? (1 = Yes). |
cardiovascular_dysfunction |
Numeric (0 or 1). Presence of cardiovascular dysfunction (e.g., hypotension, need for vasoactive drug, prolonged capillary refill). (1 = Yes). |
ards_present |
Numeric (0 or 1). Presence of Acute Respiratory Distress Syndrome (ARDS). (1 = Yes). |
multiple_organ_dysfunction |
Numeric (0 or 1). Presence of two or more other organ dysfunctions (respiratory, renal, neurologic, hematologic, hepatic). (1 = Yes). |
Value
A list containing:
Diagnosis |
The highest severity classification met (No SIRS, SIRS, Sepsis, Severe Sepsis, or Septic Shock). |
Detailed_Results |
Boolean values for each classification level. |
Criteria_Met |
Boolean values indicating which specific SIRS physiological criteria were abnormal. |
References
Goldstein B, Giroir B, Randolph A; International Consensus Conference on Pediatric Sepsis. International pediatric sepsis consensus conference: definitions for sepsis and organ dysfunction in pediatrics. Pediatr Crit Care Med. 2005;6(1):2-8. doi:10.1097/01.PCC.0000149131.72248.E6
Examples
# Example 1: Septic Shock
# Child 3y, High HR, High WBC, Infection, CV dysfunction
pediatric_sepsis_criteria("child_2y_5y", 39.0, 150, 20, 16, 0, 1, 1, 0, 0)
# Example 2: SIRS only
# Adolescent, Fever, Tachycardia, No infection
pediatric_sepsis_criteria("adolescent_13y_18y", 39.0, 120, 14, 8, 0, 0, 0, 0, 0)
Pediatric Trauma Score (PTS)
Description
Calculates the Pediatric Trauma Score (PTS) to assess injury severity in children. This tool aids in triage decisions, specifically identifying pediatric trauma patients who require transfer to a specialized pediatric trauma center. A score of 8 or lower indicates significant injury and potential for mortality.
Usage
pediatric_trauma_score(weight_kg, airway_status, systolic_bp, cns_status,
open_wound_status, skeletal_fracture_status)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. >20 kg (+2) 10-20 kg (+1) <10 kg (-1) |
airway_status |
String. Assessment of the airway. "normal" (+2) "maintainable" (+1) "unmaintainable" (-1) |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. >90 (+2) 50-90 (+1) <50 (-1) |
cns_status |
String. Central Nervous System status. "awake" (+2) "obtunded" (+1) (includes loss of consciousness) "coma" (-1) (includes decerebrate posturing) |
open_wound_status |
String. Assessment of open wounds. "none" (+2) "minor" (+1) "major" (-1) (includes penetrating wounds) |
skeletal_fracture_status |
String. Assessment of skeletal injuries. "none" (+2) "closed" (+1) "open_multiple" (-1) |
Value
A list containing:
PTS_Score |
The calculated Pediatric Trauma Score (Range -6 to 12). |
Recommendation |
Triage guidance based on the threshold of 8. |
Risk_Assessment |
Estimated mortality risk context. |
References
Tepas JJ 3rd, Mollitt DL, Talbert JL, Bryant M. The pediatric trauma score as a predictor of injury severity in the injured child. J Pediatr Surg. 1987;22(1):14-18. doi:10.1016/s0022-3468(87)80005-5
Examples
# Example 1: Severe Trauma
# 9kg (-1), Unmaintainable (-1), SBP 45 (-1), Coma (-1), Major Wound (-1), Open Fx (-1)
# Score = -6
pediatric_trauma_score(9, "unmaintainable", 45, "coma", "major", "open_multiple")
# Example 2: Minor Trauma
# 25kg (+2), Normal Airway (+2), SBP 100 (+2), Awake (+2), Minor Wound (+1), None Fx (+2)
# Score = 11
pediatric_trauma_score(25, "normal", 100, "awake", "minor", "none")
PEDIS Score for Diabetic Foot Ulcers
Description
Calculates the PEDIS Score to predict the 6-month risk of non-healing, amputation, or mortality in patients with diabetic foot ulcers. The score aggregates five domains: Perfusion, Extent (size), Depth, Infection, and Sensation.
Usage
pedis_diabetic_foot_score(perfusion_grade, extent_cm2, depth_grade,
infection_grade, sensation_grade)
Arguments
perfusion_grade |
Numeric. IWGDF Perfusion Grade (1-3). 1: No PAD (Score 0). 2: PAD but no CLI (Score 1). 3: Critical Limb Ischemia (Score 2). |
extent_cm2 |
Numeric. Area of the ulcer in cm^2. 0: Intact (Score 0). <1 cm^2 (Score 1). 1-3 cm^2 (Score 2). >3 cm^2 (Score 3). |
depth_grade |
Numeric. Depth of the ulcer. 0: Intact (Score 0). 1: Superficial (Score 1). 2: Fascia, muscle, or tendon (Score 2). 3: Bone or joint (Score 3). |
infection_grade |
Numeric. IWGDF Infection Grade (1-4). 1: None (Score 0). 2: Mild/Surface (Score 1). 3: Moderate/Abscess/Fasciitis (Score 2). 4: Severe/SIRS (Score 3). |
sensation_grade |
Numeric. Sensation status. 1: Intact (Score 0). 2: Loss of sensation (Score 1). |
Value
A list containing:
PEDIS_Score |
The calculated total score (Range 0-12). |
Risk_Assessment |
Interpretation of risk (High Risk >= 7). |
References
Chuan F, Tang K, Jiang P, et al. Reliability and validity of the perfusion, extent, depth, infection and sensation (PEDIS) classification system and score in patients with diabetic foot ulcer. PLoS One. 2015;10(4):e0124739. doi:10.1371/journal.pone.0124739
Examples
# Example 1: High Risk
# PAD (2->1), >3cm2 (3), Deep (2), Moderate Infection (3->2), No Sensation (2->1)
# Score = 1 + 3 + 2 + 2 + 1 = 9
pedis_diabetic_foot_score(2, 4.0, 2, 3, 2)
# Example 2: Low Risk
# No PAD (1->0), <1cm2 (1), Superficial (1), No Infection (1->0), Intact Sensation (1->0)
# Score = 0 + 1 + 1 + 0 + 0 = 2
pedis_diabetic_foot_score(1, 0.5, 1, 1, 1)
PEDOCS Score for Pediatric Emergency Department Overcrowding
Description
Calculates the Pediatric Emergency Department Overcrowding Scale (PEDOCS) score. This tool estimates the severity of overcrowding in a pediatric emergency department at a specific point in time based on the total number of registered patients and the number of patients in the waiting room.
Usage
pedocs_score(total_patients_registered, number_in_waiting_room)
Arguments
total_patients_registered |
Numeric. The total number of patients currently registered in the ED (including those in beds and in the waiting room). |
number_in_waiting_room |
Numeric. The number of patients currently in the waiting room. |
Details
The formula is: PEDOCS = 33.3 \times [0.11 + (0.07 \times Waiting Room) + (0.04 \times Total Registered)].
Interpretation:
0-20: Not Busy
21-60: Busy
61-100: Extremely Busy
101-140: Overcrowded
141-180: Severely Overcrowded
181-200: Dangerously Overcrowded
Value
A list containing:
PEDOCS_Score |
The calculated score (Range 0-200). |
Overcrowding_Status |
Classification of overcrowding severity. |
References
Weiss SJ, Ernst AA, Nick TG. Development of a novel measure of overcrowding in a pediatric emergency department. Pediatr Emerg Care. 2007;23(9):641-645. doi:10.1097/PEC.0b013e31814a687d
Examples
# Example 1: Not Busy
# 10 registered, 2 waiting
# Score = 33.3 * (0.11 + 0.14 + 0.4) = 33.3 * 0.65 = ~22 (Busy)
pedocs_score(10, 2)
# Example 2: Overcrowded
# 50 registered, 20 waiting
# Score = 33.3 * (0.11 + 1.4 + 2.0) = 33.3 * 3.51 = ~117 (Overcrowded)
pedocs_score(50, 20)
PedSRC Rule for Pediatric Blunt Abdominal Trauma
Description
Calculates the risk stratification for Intra-abdominal Injury (IAI) in pediatric patients with blunt abdominal trauma, based on the Pediatric Surgery Research Collaborative (PedSRC) guidelines. The rule identifies patients at very low risk for IAI who may safely avoid abdominal CT scans.
Usage
pedsrc_bat_rule(abdominal_tenderness, abdominal_wall_trauma, gcs_score, ast, alt,
urinalysis_hematuria_gt_5_rbc, abnormal_xray = 0)
Arguments
abdominal_tenderness |
Numeric (0 or 1). Presence of abdominal tenderness on physical examination. (1 = Yes). |
abdominal_wall_trauma |
Numeric (0 or 1). Evidence of abdominal wall trauma, such as bruising or a seatbelt sign. (1 = Yes). |
gcs_score |
Numeric. Glasgow Coma Scale score. (GCS < 14 is a risk factor). |
ast |
Numeric. Aspartate Aminotransferase level in U/L. (> 200 U/L is a risk factor). |
alt |
Numeric. Alanine Aminotransferase level in U/L. (> 125 U/L is a risk factor). |
urinalysis_hematuria_gt_5_rbc |
Numeric (0 or 1). Presence of microscopic hematuria (> 5 RBC/hpf) on urinalysis. (1 = Yes). |
abnormal_xray |
Numeric (0 or 1). Presence of abnormal findings on chest or pelvic X-ray (e.g., rib/pelvic fracture), if performed. (1 = Yes, 0 = No/Not Performed). |
Value
A list containing:
Risk_Classification |
"Very Low Risk" if no criteria are met, otherwise "Not Low Risk". |
Recommendation |
Clinical guidance regarding the need for CT imaging. |
Criteria_Present |
List of positive risk factors identified. |
References
Streck CJ, Vogel AM, Zhang J, et al. Pediatrics Surgery Research Collaborative (PedSRC). Derivation and validation of a clinical prediction rule for pediatric blunt abdominal trauma.
Examples
# Example 1: Low Risk
# No tenderness, no trauma sign, GCS 15, normal labs
pedsrc_bat_rule(0, 0, 15, 40, 35, 0, 0)
# Example 2: High Risk
# Seatbelt sign present (1), AST 250, Hematuria present (1)
pedsrc_bat_rule(0, 1, 15, 250, 40, 1, 0)
PEG Scale (Pain, Enjoyment, General Activity)
Description
Calculates the PEG Score, a 3-item scale used to assess chronic pain intensity and interference. It is derived from the Brief Pain Inventory (BPI) and asks patients to rate average pain, interference with enjoyment of life, and interference with general activity over the past week on a scale of 0-10.
Usage
peg_pain_scale(pain_average, enjoyment_of_life, general_activity)
Arguments
pain_average |
Numeric (0-10). What number best describes your pain on average in the past week? (0 = No pain, 10 = Pain as bad as you can imagine). |
enjoyment_of_life |
Numeric (0-10). What number describes how, during the past week, pain has interfered with your enjoyment of life? (0 = Does not interfere, 10 = Completely interferes). |
general_activity |
Numeric (0-10). What number describes how, during the past week, pain has interfered with your general activity? (0 = Does not interfere, 10 = Completely interferes). |
Value
A list containing:
PEG_Score |
The calculated score (mean of the 3 items, Range 0-10). |
Interpretation |
Clinical interpretation of pain impact severity. |
References
Krebs EE, Lorenz KA, Bair MJ, et al. Development and initial validation of the PEG, a three-item scale assessing pain intensity and interference. J Gen Intern Med. 2009;24(6):733-738. doi:10.1007/s11606-009-0981-1
Examples
# Example 1: Severe Impact
# Pain 8, Enjoyment 9, Activity 7
# Score = (8+9+7)/3 = 8.0
peg_pain_scale(8, 9, 7)
# Example 2: Mild Impact
# Pain 2, Enjoyment 1, Activity 0
# Score = 1.0
peg_pain_scale(2, 1, 0)
Pediatric End-Stage Liver Disease (PELD) Score (2023 Update)
Description
Calculates the updated PELD score (often referred to as PELD-Cr) used by the OPTN for liver transplant prioritization in children under 12 years of age. This version, effective July 2023, incorporates serum creatinine into the calculation to better predict waitlist mortality.
Usage
peld_cr_score(bilirubin, inr, albumin, creatinine, age_years, growth_failure,
on_dialysis = 0, bilirubin_units = "mg/dL",
albumin_units = "g/dL", creatinine_units = "mg/dL")
Arguments
bilirubin |
Numeric. Total Bilirubin level. |
inr |
Numeric. International Normalized Ratio. |
albumin |
Numeric. Serum Albumin level. |
creatinine |
Numeric. Serum Creatinine level. |
age_years |
Numeric. Patient age in years. (Points added if Age < 1 year). |
growth_failure |
Numeric (0 or 1). Presence of growth failure (defined as height or weight < -2 standard deviations below the mean for age and gender). (1 = Yes, + points). |
on_dialysis |
Numeric (0 or 1). History of dialysis (2 or more times in the last week) or 24 hours of CVVHD. (1 = Yes). If Yes, creatinine is set to 4.0 mg/dL. |
bilirubin_units |
String. Units for bilirubin. "mg/dL" (default) or "umol/L". |
albumin_units |
String. Units for albumin. "g/dL" (default) or "g/L". |
creatinine_units |
String. Units for creatinine. "mg/dL" (default) or "umol/L". |
Details
The formula is:
PELD = 10 \times (0.480 \times \ln(Bilirubin) + 1.857 \times \ln(INR) - 0.687 \times \ln(Albumin) + 0.961 \times \ln(Creatinine) + 0.436 \times (Age<1) + 0.667 \times (GrowthFailure))
Adjustments: - Bilirubin < 1 set to 1. - INR < 1 set to 1. - Creatinine < 0.1 set to 0.1. - Creatinine > 4 set to 4.
Value
A list containing:
PELD_Cr_Score |
The calculated PELD score. |
References
OPTN Policy Notice. Update to PELD Score Calculation. 2023.
Examples
# Example 1: Infant with growth failure and renal impairment
# Age 0.5, Bili 3.0, INR 1.5, Alb 2.5, Cr 0.8, Growth Failure Yes
peld_cr_score(3.0, 1.5, 2.5, 0.8, 0.5, 1)
# Example 2: Child, no growth failure, normal renal
# Age 5, Bili 1.0, INR 1.0, Alb 4.0, Cr 0.3, Growth Failure No
peld_cr_score(1.0, 1.0, 4.0, 0.3, 5, 0)
PELD Score (Pediatric End-Stage Liver Disease) (Original/Pre-2023)
Description
Calculates the PELD score used to prioritize pediatric candidates (younger than 12 years) for liver transplantation. This score estimates the 3-month risk of waitlist mortality using serum bilirubin, INR, albumin, age, and growth failure. (Note: In July 2023, the OPTN updated to the PELD-Cr score, which includes creatinine).
Usage
peld_score_original(bilirubin, inr, albumin, age_years, growth_failure,
bilirubin_units = "mg/dL", albumin_units = "g/dL")
Arguments
bilirubin |
Numeric. Total Bilirubin level. |
inr |
Numeric. International Normalized Ratio. |
albumin |
Numeric. Serum Albumin level. |
age_years |
Numeric. Patient age in years. |
growth_failure |
Numeric (0 or 1). Presence of growth failure (height or weight < -2 SD below mean for age/gender). (1 = Yes). |
bilirubin_units |
String. Units for bilirubin. "mg/dL" (default) or "umol/L". |
albumin_units |
String. Units for albumin. "g/dL" (default) or "g/L". |
Details
The formula is:
PELD = 10 \times (0.480 \times \ln(Bilirubin) + 1.857 \times \ln(INR) - 0.687 \times \ln(Albumin) + 0.436 \times (Age < 1) + 0.667 \times (Growth Failure))
Input adjustments: Bilirubin and INR values < 1.0 are set to 1.0.
Value
A list containing:
PELD_Score |
The calculated PELD score (rounded). |
References
McDiarmid SV, Anand R, Lindblad AS, et al. Development of a pediatric end-stage liver disease score to predict poor outcome in children awaiting liver transplantation. Transplantation. 2002;74(2):173-181. doi:10.1097/00007890-200207270-00006
Examples
# Example 1: High Risk Infant
# Age 0.5 (<1y), Bili 3.0, INR 1.5, Alb 2.5, Growth Failure Yes
peld_score_original(3.0, 1.5, 2.5, 0.5, 1)
# Example 2: Standard Child
# Age 5, Bili 1.0, INR 1.0, Alb 4.0, Growth Failure No
peld_score_original(1.0, 1.0, 4.0, 5, 0)
PEN-FAST Penicillin Allergy Decision Rule
Description
Calculates the PEN-FAST score to identify low-risk penicillin allergy patients who may safely undergo direct oral challenge. The score uses three clinical criteria (Five years or less since reaction, Anaphylaxis/angioedema, Treatment required) and considers Severe Cutaneous Adverse Reactions (SCAR) as an exclusion/high-risk factor.
Usage
pen_fast_score(five_years_or_less, anaphylaxis_or_angioedema,
treatment_required, severe_cutaneous_reaction = 0)
Arguments
five_years_or_less |
Numeric (0 or 1). Did the reaction occur 5 years ago or less? (1 = Yes, +2 points). |
anaphylaxis_or_angioedema |
Numeric (0 or 1). Did the reaction involve anaphylaxis or angioedema? (1 = Yes, +2 points). |
treatment_required |
Numeric (0 or 1). Did the reaction require treatment? (1 = Yes, +1 point). |
severe_cutaneous_reaction |
Numeric (0 or 1). Is there a history of Severe Cutaneous Adverse Reaction (SCAR), such as SJS, TEN, or DRESS? (1 = Yes). Presence of SCAR typically contraindicates oral challenge regardless of the score. |
Value
A list containing:
PEN_FAST_Score |
The calculated risk score (Range 0-5). |
Risk_Category |
Risk classification (Low Risk < 3, Moderate/High Risk >= 3). |
Interpretation |
Clinical guidance based on the score. |
References
Trubiano JA, Vogrin S, Chua KYL, et al. Development and Validation of a Penicillin Allergy Clinical Decision Rule. JAMA Intern Med. 2020;180(5):745-752. doi:10.1001/jamainternmed.2020.0403
Examples
# Example 1: Low Risk
# Reaction >5 years ago (0), No anaphylaxis (0), Treatment required (1)
# Score = 1
pen_fast_score(0, 0, 1)
# Example 2: High Risk
# Reaction <5 years ago (2), Anaphylaxis (2), Treatment (1)
# Score = 5
pen_fast_score(1, 1, 1)
PERC Rule for Pulmonary Embolism
Description
Calculates the Pulmonary Embolism Rule-out Criteria (PERC) to rule out PE in patients with a low pre-test probability. If all 8 criteria are negative, the risk of PE is considered less than 2%, and no further testing (D-dimer or imaging) is required.
Usage
perc_rule_pulmonary_embolism(age, heart_rate, oxygen_saturation, prior_pe_dvt,
recent_trauma_surgery, hemoptysis, exogenous_estrogen,
unilateral_leg_swelling)
Arguments
age |
Numeric. Patient age in years. (>= 50 is a positive finding). |
heart_rate |
Numeric. Heart rate in beats per minute. (>= 100 is a positive finding). |
oxygen_saturation |
Numeric. Oxygen saturation percentage (SaO2). (< 95% is a positive finding). |
prior_pe_dvt |
Numeric (0 or 1). Prior history of DVT or PE. (1 = Yes). |
recent_trauma_surgery |
Numeric (0 or 1). Recent trauma or surgery (within 4 weeks) requiring hospitalization. (1 = Yes). |
hemoptysis |
Numeric (0 or 1). Presence of hemoptysis. (1 = Yes). |
exogenous_estrogen |
Numeric (0 or 1). Use of exogenous estrogen (OCP, HRT). (1 = Yes). |
unilateral_leg_swelling |
Numeric (0 or 1). Unilateral leg swelling suggestive of DVT. (1 = Yes). |
Value
A list containing:
Result |
"PERC Rule Negative" or "PERC Rule Not Met". |
Recommendation |
Clinical guidance based on the result. |
Positive_Criteria |
A list of criteria that prevented the rule from being negative. |
References
Kline JA, Mitchell AM, Kabrhel C, et al. Clinical criteria to prevent unnecessary diagnostic testing in emergency department patients with suspected pulmonary embolism. J Thromb Haemost. 2004;2(8):1247-1255. doi:10.1111/j.1538-7836.2004.00790.x
Examples
# Example 1: PERC Negative
# 30yo, HR 80, SaO2 98%, No other factors
perc_rule_pulmonary_embolism(30, 80, 98, 0, 0, 0, 0, 0)
# Example 2: PERC Not Met
# 30yo, HR 80, SaO2 98%, Taking OCP (Estrogen)
perc_rule_pulmonary_embolism(30, 80, 98, 0, 0, 0, 1, 0)
Perioperative Anticoagulation Use for Surgery Evaluation (PAUSE)
Description
Provides standardized perioperative management recommendations for patients with Atrial Fibrillation (AF) who are taking a Direct Oral Anticoagulant (DOAC) and require an elective surgery or procedure. The logic follows the PAUSE study protocol to minimize bleeding risk while preventing thromboembolism without heparin bridging.
Usage
perioperative_anticoagulation_pause(drug_name, procedure_bleeding_risk, crcl_ml_min)
Arguments
drug_name |
String. The DOAC being used. Options: "apixaban", "rivaroxaban", "edoxaban", "dabigatran". |
procedure_bleeding_risk |
String. The bleeding risk associated with the planned procedure. Options: "low", "high". |
crcl_ml_min |
Numeric. Creatinine Clearance in mL/min. Used specifically to adjust interruption windows for Dabigatran or check validity for Xa inhibitors. |
Value
A list containing:
PreOp_Recommendation |
Instruction on how many days prior to surgery to stop the medication. |
Last_Dose_Timing |
Specific guidance on when the final pre-operative dose should be taken. |
PostOp_Resumption |
Guidance on when to restart the medication based on bleeding risk. |
References
Douketis JD, Spyropoulos AC, Duncan J, et al. Perioperative Management of Patients With Atrial Fibrillation Receiving a Direct Oral Anticoagulant. JAMA Intern Med. 2019;179(11):1469-1478. doi:10.1001/jamainternmed.2019.2431
Examples
# Example 1: Apixaban, Low Risk Procedure
perioperative_anticoagulation_pause("apixaban", "low", 60)
# Example 2: Dabigatran, High Risk Procedure, Renal Impairment (CrCl 40)
perioperative_anticoagulation_pause("dabigatran", "high", 40)
Pulmonary Embolism Severity Index (PESI)
Description
Calculates the Pulmonary Embolism Severity Index (PESI) to stratify the risk of 30-day mortality in patients with confirmed pulmonary embolism (PE). The score sums points derived from 11 clinical variables (demographics, comorbidities, and vital signs).
Usage
pesi_score(age, sex, cancer_history, heart_failure_history, chronic_lung_disease,
heart_rate, systolic_bp, respiratory_rate, temperature,
altered_mental_status, oxygen_saturation)
Arguments
age |
Numeric. Patient age in years. (Points = Age in years). |
sex |
String. Patient sex ("Male" or "Female"). (Male adds 10 points). |
cancer_history |
Numeric (0 or 1). History of cancer. (1 = Yes, +30 points). |
heart_failure_history |
Numeric (0 or 1). History of heart failure. (1 = Yes, +10 points). |
chronic_lung_disease |
Numeric (0 or 1). History of chronic lung disease. (1 = Yes, +10 points). |
heart_rate |
Numeric. Heart rate in beats per minute. (>= 110 bpm adds 20 points). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. (< 100 mmHg adds 30 points). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. (>= 30 bpm adds 20 points). |
temperature |
Numeric. Body temperature in degrees Celsius. (< 36 C adds 20 points). |
altered_mental_status |
Numeric (0 or 1). Altered mental status (disorientation, lethargy, stupor, or coma). (1 = Yes, +60 points). |
oxygen_saturation |
Numeric. Arterial oxyhemoglobin saturation (%). (< 90% adds 20 points). |
Value
A list containing:
PESI_Score |
The calculated total score. |
Risk_Class |
The risk classification (Class I - V). |
Est_30_Day_Mortality |
Estimated 30-day all-cause mortality percentage. |
Recommendation |
Clinical guidance on site of care (Outpatient vs. Inpatient). |
References
Aujesky D, Obrosky DS, Stone RA, et al. Derivation and validation of a prognostic model for pulmonary embolism. Am J Respir Crit Care Med. 2005;172(8):1041-1046. doi:10.1164/rccm.200506-862OC
Examples
# Example 1: High Risk (Class V)
# 80yo Male (+10), Altered Mental Status (+60), SBP 90 (+30)
# Score = 80 + 10 + 60 + 30 = 180
pesi_score(80, "male", 0, 0, 0, 100, 90, 20, 37, 1, 95)
# Example 2: Low Risk (Class II)
# 50yo Female, History of Cancer (+30), stable vitals
# Score = 50 + 0 + 30 = 80
pesi_score(50, "female", 1, 0, 0, 80, 120, 16, 37, 0, 98)
Pediatric Early Warning Score (PEWS)
Description
Calculates the Pediatric Early Warning Score (PEWS) based on the Monaghan (Brighton) methodology. This score is used to identify pediatric patients at risk for clinical deterioration. It evaluates three physiological domains (Behavior, Cardiovascular, Respiratory) and includes adjustments for nebulizer use and persistent vomiting.
Usage
pews_score(behavior_score, cardiovascular_score, respiratory_score,
nebulizer_use, persistent_vomiting)
Arguments
behavior_score |
Numeric (0-3). 0: Playing/Appropriate. 1: Sleeping. 2: Irritable. 3: Lethargic/Confused or reduced response to pain. |
cardiovascular_score |
Numeric (0-3). 0: Pink or Capillary Refill (CRT) 1-2s. 1: Pale or CRT 3s. 2: Grey or CRT 4s or Tachycardia of 20 bpm above normal. 3: Grey/Mottled or CRT >=5s or Tachycardia of 30 bpm above normal or Bradycardia. |
respiratory_score |
Numeric (0-3). 0: Within normal parameters, no recession. 1: >10 above normal RR, using accessory muscles, or 30%+ O2 (or >2L/min). 2: >20 above normal RR, recession, or 40%+ O2 (or >4L/min). 3: 5 below normal RR with retractions/grunting, or 50%+ O2 (or >6L/min). |
nebulizer_use |
Numeric (0 or 1). Use of nebulizer treatment (e.g., every 15 minutes). (1 = Yes, +2 points). |
persistent_vomiting |
Numeric (0 or 1). Presence of persistent vomiting following surgery. (1 = Yes, +2 points). |
Value
A list containing:
PEWS_Score |
The calculated total PEWS score. |
Risk_Level |
Risk stratification (Low, Low-Intermediate, Intermediate, High). |
Action_Guidance |
Suggested clinical response based on the score. |
References
Monaghan A. Detecting and managing deterioration in children. Paediatr Nurs. 2005;17(1):32-35. doi:10.7748/paed2005.02.17.1.32.c964
Examples
# Example 1: Stable Patient
# Behavior 0, CV 0, Resp 0, No neb/vomit
pews_score(0, 0, 0, 0, 0)
# Example 2: High Risk Patient
# Lethargic (3), Grey (2), Retractions (2), On Nebs (1)
# Score = 3 + 2 + 2 + 2 = 9
pews_score(3, 2, 2, 1, 0)
Pediatric Fibrosis Score (Continuous) (pFIB-c)
Description
Calculates the continuous Pediatric Fibrosis Score (pFIB-c) to predict the probability of advanced liver fibrosis (Stage F3-F4) in children with Metabolic Dysfunction-Associated Steatotic Liver Disease (MASLD). The score is derived from four clinical variables: AST, ALT, Platelet count, and BMI z-score.
Usage
pfib_c_score(ast, alt, platelet_count, bmi_z_score)
Arguments
ast |
Numeric. Aspartate Aminotransferase level in U/L. |
alt |
Numeric. Alanine Aminotransferase level in U/L. |
platelet_count |
Numeric. Platelet count in x10^9/L (e.g., 250). |
bmi_z_score |
Numeric. Body Mass Index z-score (standard deviation score based on age and sex). |
Details
The logit formula used is:
Logit = -6.892 + (0.023 \times AST) + (0.028 \times ALT) - (0.010 \times Platelets) + (1.126 \times BMI\_z)
pFIB-c = \frac{1}{1 + e^{-Logit}}
Value
A list containing:
pFIB_c_Probability |
The calculated probability (0-1) of advanced fibrosis. |
Risk_Category |
Interpretation (Low Risk < 0.1, High Risk >= 0.5). |
References
Alkhouri N, et al. Development and validation of the Pediatric Fibrosis Score (pFIB) and the Pediatric Fibrosis Score Continuous (pFIB-c) for the prediction of liver fibrosis in children with non-alcoholic fatty liver disease. Hepatology. 2024.
Examples
# Example 1: High Risk
# AST 60, ALT 80, Platelets 150, BMI z-score 2.5
pfib_c_score(60, 80, 150, 2.5)
# Example 2: Low Risk
# AST 25, ALT 30, Platelets 300, BMI z-score 1.0
pfib_c_score(25, 30, 300, 1.0)
PHASES Score for Unruptured Intracranial Aneurysms
Description
Calculates the PHASES score to predict the 5-year risk of aneurysm rupture in patients with unruptured intracranial aneurysms. The score is based on Population, Hypertension, Age, Size of aneurysm, Earlier SAH, and Site of aneurysm.
Usage
phases_aneurysm_score(population, hypertension, age, aneurysm_size_mm,
history_sah, aneurysm_site)
Arguments
population |
String. Ethnicity/Population of the patient. "other": North American, European (not Finnish) (0 points). "japanese": Japanese (3 points). "finnish": Finnish (5 points). |
hypertension |
Numeric (0 or 1). History of hypertension. (1 = Yes). |
age |
Numeric. Patient age in years. (>= 70 years adds 1 point). |
aneurysm_size_mm |
Numeric. Maximum diameter of the aneurysm in millimeters. < 7.0 mm: 0 points. 7.0 - 9.9 mm: 3 points. 10.0 - 19.9 mm: 6 points. >= 20.0 mm: 10 points. |
history_sah |
Numeric (0 or 1). History of Subarachnoid Hemorrhage (SAH) from another aneurysm. (1 = Yes). |
aneurysm_site |
String. Location of the aneurysm. "ica": Internal Carotid Artery (0 points). "mca": Middle Cerebral Artery (2 points). "posterior_aca_pcom": Posterior circulation, Anterior Cerebral Artery, or Posterior Communicating Artery (4 points). |
Value
A list containing:
PHASES_Score |
The calculated total score (Range 0-22). |
Risk_5_Year_Rupture |
The estimated 5-year absolute risk of aneurysm rupture percentage. |
References
Greving JP, Wermer MJ, Brown RD Jr, et al. Development of the PHASES score for prediction of risk of rupture of intracranial aneurysms: a pooled analysis of six prospective cohort studies. Lancet Neurol. 2014;13(1):59-66. doi:10.1016/S1474-4422(13)70263-1
Examples
# Example 1: Low Risk
# US patient, No HTN, Age 50, 4mm ICA aneurysm, No SAH history
# Score = 0 + 0 + 0 + 0 + 0 + 0 = 0
phases_aneurysm_score("other", 0, 50, 4, 0, "ica")
# Example 2: High Risk
# Finnish, HTN, Age 72, 8mm MCA aneurysm, History of SAH
# Score = 5 + 1 + 1 + 3 + 1 + 2 = 13
phases_aneurysm_score("finnish", 1, 72, 8, 1, "mca")
Phenytoin (Dilantin) Correction for Albumin and Renal Failure
Description
Calculates the corrected phenytoin level using the Sheiner-Tozer equation. Phenytoin is highly protein-bound (typically ~90% to albumin). In states of hypoalbuminemia or uremia (renal failure), the fraction of free (active) phenytoin increases, making total serum levels misleadingly low. This correction estimates the phenytoin level as if the patient had normal protein binding, allowing for comparison with the standard therapeutic range (10-20 mcg/mL).
Usage
phenytoin_correction(measured_phenytoin, albumin, renal_failure)
Arguments
measured_phenytoin |
Numeric. The measured total serum phenytoin level in mcg/mL (or mg/L). |
albumin |
Numeric. The patient's serum albumin level in g/dL. |
renal_failure |
Numeric (0 or 1). Presence of end-stage renal disease (CrCl < 10-15 mL/min or on dialysis). (1 = Yes, 0 = No). |
Details
The formulas used are:
-
Normal Renal Function:
Corrected = \frac{Measured}{(0.2 \times Albumin) + 0.1} -
Renal Failure / Uremia:
Corrected = \frac{Measured}{(0.1 \times Albumin) + 0.1}
Note: The factor 0.2 represents the normal free fraction (10%) divided by the normal albumin (approx 4.4 g/dL). In uremia, the affinity of albumin for phenytoin is decreased, necessitating a different coefficient (0.1).
Value
A list containing:
Corrected_Phenytoin_mcg_mL |
The estimated corrected total phenytoin level. |
References
Sheiner LB, Tozer TN. Clinical pharmacokinetics: the use of plasma concentrations of drugs. In: Melmon KL, Morrelli HF, eds. Clinical Pharmacology: Basic Principles in Therapeutics. 2nd ed. New York, NY: Macmillan; 1978:71-109. Winter ME. Phenytoin. In: Basic Clinical Pharmacokinetics. 3rd ed. Vancouver, WA: Applied Therapeutics, Inc; 1994.
Examples
# Example 1: Hypoalbuminemia (Alb 2.5) with Normal Renal Function
# Measured 8 mcg/mL -> Corrected = 8 / ((0.2*2.5) + 0.1) = 8 / 0.6 = 13.3
phenytoin_correction(8, 2.5, 0)
# Example 2: Renal Failure (Alb 3.0)
# Measured 8 mcg/mL -> Corrected = 8 / ((0.1*3.0) + 0.1) = 8 / 0.4 = 20.0
phenytoin_correction(8, 3.0, 1)
Phoenix Sepsis Score (Pediatric Sepsis Criteria)
Description
Calculates the Phoenix Sepsis Score for pediatric patients (<18 years). This score replaces previous SIRS-based definitions and is used to diagnose sepsis in children with suspected infection. A score of 2 or higher indicates sepsis and is associated with higher in-hospital mortality. The score evaluates four organ systems: Respiratory, Cardiovascular, Coagulation, and Neurologic.
Usage
phoenix_sepsis_score(respiratory_support_type, pao2 = NA, spo2 = NA, fio2 = NA,
vasoactive_med_count, lactate_mmol_l, map_below_5th_percentile_age,
platelet_count, inr, d_dimer_mg_l, fibrinogen_mg_dl,
gcs_score, fixed_pupils)
Arguments
respiratory_support_type |
String. Type of respiratory support. Options: "none", "non_invasive" (includes HFNC, NIV, or O2), "invasive" (IMV). |
pao2 |
Numeric. PaO2 in mmHg (optional). |
spo2 |
Numeric. SpO2 percent (optional). |
fio2 |
Numeric. Fraction of inspired oxygen (e.g., 0.21 or 21). |
vasoactive_med_count |
Numeric. Number of vasoactive medications being administered (0, 1, 2, >=3). Includes: dobutamine, dopamine, epinephrine, milrinone, norepinephrine, vasopressin. |
lactate_mmol_l |
Numeric. Serum lactate level in mmol/L. |
map_below_5th_percentile_age |
Numeric (0 or 1). Is the Mean Arterial Pressure (MAP) below the 5th percentile for age? (1 = Yes). |
platelet_count |
Numeric. Platelet count in x10^3/uL. |
inr |
Numeric. International Normalized Ratio. |
d_dimer_mg_l |
Numeric. D-dimer level in mg/L FEU. |
fibrinogen_mg_dl |
Numeric. Fibrinogen level in mg/dL. |
gcs_score |
Numeric. Glasgow Coma Scale score. |
fixed_pupils |
Numeric (0 or 1). Are pupils bilaterally fixed? (1 = Yes). |
Value
A list containing:
Phoenix_Sepsis_Score |
The total calculated score (Range 0-11). |
Subscores |
Individual scores for each organ system. |
Diagnosis |
Interpretation based on the >=2 point threshold. |
References
Sanchez-Pinto LN, Bennett TD, DeWitt PE, et al. Development and Validation of the Phoenix Criteria for Pediatric Sepsis and Septic Shock. JAMA. 2024;331(8):675-686. doi:10.1001/jama.2024.0196
Examples
# Example 1: Sepsis (Score 2)
# On IMV (1 pt), Normal Labs, GCS 9 (1 pt)
phoenix_sepsis_score("invasive", NA, 98, 30, 0, 1.0, 0, 250, 1.0, 0.5, 200, 9, 0)
# Example 2: Septic Shock (High Score)
# On IMV with severe hypoxemia (3 pts), 2 Vasoactives (4 pts), Plt 50 (1 pt), GCS 15 (0 pts)
# Total = 8
phoenix_sepsis_score("invasive", 60, 90, 100, 2, 4.0, 1, 50, 1.2, 0.5, 200, 15, 0)
Patient Health Questionnaire-9 (PHQ-9)
Description
Calculates the PHQ-9 total score to screen for and measure the severity of depression. The scale consists of 9 items corresponding to the DSM-IV criteria for major depressive disorder.
Usage
phq9_score(interest, depressed, sleep, energy, appetite, failure,
concentration, psychomotor, suicide)
Arguments
interest |
Numeric (0-3). Little interest or pleasure in doing things. 0: Not at all 1: Several days 2: More than half the days 3: Nearly every day |
depressed |
Numeric (0-3). Feeling down, depressed, or hopeless. |
sleep |
Numeric (0-3). Trouble falling or staying asleep, or sleeping too much. |
energy |
Numeric (0-3). Feeling tired or having little energy. |
appetite |
Numeric (0-3). Poor appetite or overeating. |
failure |
Numeric (0-3). Feeling bad about yourself - or that you are a failure or have let yourself or your family down. |
concentration |
Numeric (0-3). Trouble concentrating on things, such as reading the newspaper or watching television. |
psychomotor |
Numeric (0-3). Moving or speaking so slowly that other people could have noticed? Or the opposite - being so fidgety or restless that you have been moving around a lot more than usual. |
suicide |
Numeric (0-3). Thoughts that you would be better off dead or of hurting yourself in some way. |
Value
A list containing:
PHQ9_Score |
The calculated total score (Range 0-27). |
Severity |
Depression severity category (None-minimal, Mild, Moderate, Moderately Severe, Severe). |
References
Kroenke K, Spitzer RL, Williams JB. The PHQ-9: validity of a brief depression severity measure. J Gen Intern Med. 2001;16(9):606-613. doi:10.1046/j.1525-1497.2001.016009606.x
Examples
# Example 1: Moderate Depression
# Several days (1) for most, More than half (2) for sleep/energy
phq9_score(1, 1, 2, 2, 1, 1, 1, 1, 0)
# Example 2: Severe Depression
# Nearly every day (3) for most items
phq9_score(3, 3, 3, 3, 2, 3, 2, 3, 1)
PIAMA Risk Score for Asthma Prediction
Description
Calculates the Prevention and Incidence of Asthma and Mite Allergy (PIAMA) Risk Score. This tool predicts the probability of a preschool-aged child (tested around age 4) developing asthma by school age (age 8), based on eight clinical and demographic variables.
Usage
piama_risk_score(sex, gestational_age_gt_40_weeks,
parental_education_low_intermediate, parental_asthma,
eczema, wheezing_frequency, wheezing_apart_from_colds,
inhaled_medication)
Arguments
sex |
String. Child's sex ("Male" or "Female"). (Male adds 2 points). |
gestational_age_gt_40_weeks |
Numeric (0 or 1). Was the child born post-term (> 40 weeks gestation)? (1 = Yes, +1 point). |
parental_education_low_intermediate |
Numeric (0 or 1). Is maternal/paternal education level low or intermediate (i.e., not high/tertiary)? (1 = Yes, +1 point). |
parental_asthma |
Numeric (0 or 1). Does a parent have asthma? (1 = Yes, +2 points). |
eczema |
Numeric (0 or 1). Does the child have eczema? (1 = Yes, +1 point). |
wheezing_frequency |
String. Frequency of wheezing in the past year. "none": 0 points. "1_to_3": 1-3 episodes (+1 point). "4_or_more": >= 4 episodes (+5 points). |
wheezing_apart_from_colds |
Numeric (0 or 1). Does wheezing occur apart from colds? (1 = Yes, +2 points). |
inhaled_medication |
Numeric (0 or 1). Did the child use inhaled medication (bronchodilators or steroids) in the last year? (1 = Yes, +4 points). |
Value
A list containing:
PIAMA_Score |
The calculated risk score (Range 0-18). |
Asthma_Risk_Age_8 |
Estimated probability of having asthma at age 8 years. |
References
Caudri D, Wijga A, A Schipper CM, et al. Predicting the long-term prognosis of children with symptoms suggestive of asthma at preschool age. J Allergy Clin Immunol. 2009;124(5):903-910.e1-7. doi:10.1016/j.jaci.2009.06.045
Examples
# Example 1: High Risk
# Male (+2), Post-term (+1), Parent Asthma (+2), Wheeze >4x (+5), Meds (+4)
# Score = 14
piama_risk_score("male", 1, 0, 1, 0, "4_or_more", 0, 1)
# Example 2: Low Risk
# Female, Term, High Education, No Hx, Wheeze 1-3x (+1)
# Score = 1
piama_risk_score("female", 0, 0, 0, 0, "1_to_3", 0, 0)
PIRO Score for Community-Acquired Pneumonia (CAP)
Description
Calculates the PIRO score (Predisposition, Insult, Response, Organ dysfunction) to stratify the severity and mortality risk in patients admitted to the ICU with Community-Acquired Pneumonia.
Usage
piro_cap_score(age, copd, immunocompromised, multilobar_opacities, bacteremia,
shock, severe_hypoxemia, acute_renal_failure)
Arguments
age |
Numeric. Patient age in years. (> 70 years adds 1 point). |
copd |
Numeric (0 or 1). History of Chronic Obstructive Pulmonary Disease. (1 = Yes, +1 point). |
immunocompromised |
Numeric (0 or 1). Immunocompromised state (e.g., corticosteroids, HIV, chemotherapy, transplant). (1 = Yes, +1 point). |
multilobar_opacities |
Numeric (0 or 1). Presence of multilobar opacities on chest radiograph. (1 = Yes, +1 point). |
bacteremia |
Numeric (0 or 1). Presence of bacteremia (positive blood cultures). (1 = Yes, +1 point). |
shock |
Numeric (0 or 1). Systolic BP < 90 mmHg or requirement for vasopressors. (1 = Yes, +1 point). |
severe_hypoxemia |
Numeric (0 or 1). PaO2/FiO2 ratio < 150 mmHg. (1 = Yes, +1 point). |
acute_renal_failure |
Numeric (0 or 1). Serum Creatinine > 1.2 mg/dL (> 106 µmol/L) or BUN > 20 mg/dL (> 7.14 mmol/L). (1 = Yes, +1 point). |
Value
A list containing:
PIRO_Score |
The calculated score (Range 0-8). |
Risk_Category |
Risk stratification (Low, Mild/Intermediate, High, Very High). |
Mortality_Risk_28_Day |
Estimated 28-day mortality probability. |
References
Rello J, Rodriguez A, Lisboa T, et al. PIRO score for community-acquired pneumonia: a new prediction rule for assessment of severity in intensive care unit patients with community-acquired pneumonia. Crit Care Med. 2009;37(2):456-462. doi:10.1097/CCM.0b013e3181958ca0
Examples
# Example 1: Low Risk
# Age 60, No comorbidities, Multilobar (1), No shock, Normal labs
# Score = 1
piro_cap_score(60, 0, 0, 1, 0, 0, 0, 0)
# Example 2: High Risk
# Age 75 (1), COPD (1), Shock (1), Renal Failure (1)
# Score = 4
piro_cap_score(75, 1, 0, 0, 0, 1, 0, 1)
Pittsburgh Knee Rules
Description
Applies the Pittsburgh Knee Rules to determine the need for knee radiography in patients with acute knee injury. This decision rule is highly sensitive for detecting knee fractures and can reduce unnecessary imaging.
Usage
pittsburgh_knee_rules(blunt_trauma_or_fall, age_years, unable_to_walk_4_steps_in_ed)
Arguments
blunt_trauma_or_fall |
Numeric (0 or 1). Did the injury involve blunt trauma or a fall? (1 = Yes). This is the entry criterion for the rule. |
age_years |
Numeric. Patient age in years. |
unable_to_walk_4_steps_in_ed |
Numeric (0 or 1). Is the patient unable to walk 4 weight-bearing steps in the emergency department? (1 = Yes). |
Details
Imaging is indicated if the mechanism is blunt trauma or fall AND one of the following is met:
Age < 12 years
Age > 50 years
Inability to walk 4 weight-bearing steps in the ED
Value
A list containing:
Recommendation |
Guidance on whether a knee X-ray is indicated. |
References
Seaberg DC, Yealy DM, Lukens T, Auble T, Mathiasen RA. Multicenter comparison of two clinical decision rules for the use of radiography in acute, high-risk knee injuries. Ann Emerg Med. 1998;32(1):8-13. doi:10.1016/s0196-0644(98)70094-4
Examples
# Example 1: X-ray Indicated (Age)
# Trauma (1), Age 60, Can walk (0)
pittsburgh_knee_rules(1, 60, 0)
# Example 2: X-ray Indicated (Inability to walk)
# Trauma (1), Age 30, Cannot walk (1)
pittsburgh_knee_rules(1, 30, 1)
# Example 3: Not Indicated
# Trauma (1), Age 30, Can walk (0)
pittsburgh_knee_rules(1, 30, 0)
Pittsburgh Response to Endovascular Therapy (PRE) Score
Description
Calculates the PRE Score to predict functional outcome at 90 days (defined as mRS 0-2) in patients with large vessel occlusion acute ischemic stroke undergoing endovascular therapy (thrombectomy). The score utilizes pre-procedure variables: Age, NIHSS, ASPECTS, and pre-stroke modified Rankin Scale.
Usage
pittsburgh_response_endovascular_score(age, nihss_score, aspects_score, pre_stroke_mrs)
Arguments
age |
Numeric. Patient age in years. |
nihss_score |
Numeric. National Institutes of Health Stroke Scale score (0-42). |
aspects_score |
Numeric. Alberta Stroke Program Early CT Score (0-10). |
pre_stroke_mrs |
Numeric. Pre-stroke modified Rankin Scale (0-5). |
Details
Scoring System:
-
Age: <60 (0), 60-69 (2), 70-79 (4), >=80 (6).
-
NIHSS: <10 (0), 10-15 (2), 16-20 (4), >=21 (6).
-
ASPECTS: 10 (0), 8-9 (2), <=7 (4).
-
Pre-stroke mRS: 0 (0), 1 (2), >=2 (4).
The total score ranges from 0 to 20. Lower scores correlate with higher probability of good functional outcome.
Value
A list containing:
PRE_Score |
The calculated total score. |
Interpretation |
Prognostic implication regarding 90-day functional independence. |
References
Jadhav AP, et al. The Pittsburgh Response to Endovascular therapy (PRE) score: predicting functional outcome after endovascular therapy for acute ischemic stroke. J Neurointerv Surg. 2020.
Examples
# Example 1: Good Prognosis Candidate
# Age 55 (0), NIHSS 12 (2), ASPECTS 10 (0), Pre-mRS 0 (0)
pittsburgh_response_endovascular_score(55, 12, 10, 0)
# Example 2: Poor Prognosis Candidate
# Age 82 (6), NIHSS 22 (6), ASPECTS 6 (4), Pre-mRS 3 (4)
pittsburgh_response_endovascular_score(82, 22, 6, 3)
PLAN Score for Stroke
Description
Calculates the PLAN score to predict 30-day and 1-year mortality, as well as severe disability (mRS 5-6) at discharge, for patients with acute ischemic stroke. The score uses clinical variables including Preadmission comorbidities, Level of consciousness, Age, and Neurologic deficit.
Usage
plan_stroke_score(age, preadmission_dependence, cancer, congestive_heart_failure,
atrial_fibrillation, reduced_consciousness, arm_weakness,
leg_weakness, aphasia_neglect)
Arguments
age |
Numeric. Patient age in years. 61-70: 2 pts. 71-80: 5 pts. 81-90: 7 pts. >90: 9 pts. |
preadmission_dependence |
Numeric (0 or 1). Preadmission dependence (e.g., Rankin score >= 3) requiring assistance for ADLs. (1 = Yes, +1.5 pts). |
cancer |
Numeric (0 or 1). History of cancer (excluding non-melanoma skin cancer). (1 = Yes, +1.5 pts). |
congestive_heart_failure |
Numeric (0 or 1). History of congestive heart failure. (1 = Yes, +1 pt). |
atrial_fibrillation |
Numeric (0 or 1). History of atrial fibrillation. (1 = Yes, +1 pt). |
reduced_consciousness |
Numeric (0 or 1). Reduced level of consciousness on admission (not fully alert). (1 = Yes, +5 pts). |
arm_weakness |
Numeric (0 or 1). Significant or total arm weakness. (1 = Yes, +2 pts). |
leg_weakness |
Numeric (0 or 1). Significant or total leg weakness. (1 = Yes, +2 pts). |
aphasia_neglect |
Numeric (0 or 1). Presence of aphasia or neglect. (1 = Yes, +1 pt). |
Value
A list containing:
PLAN_Score |
The calculated total risk score. |
Est_30_Day_Mortality |
Estimated 30-day mortality percentage. |
Est_1_Year_Mortality |
Estimated 1-year mortality percentage. |
Poor_Outcome_Discharge_mRS_5_6 |
Estimated percentage of patients with mRS 5-6 (severe disability or death) at discharge. |
References
O'Donnell MJ, Fang J, D'Uva C, et al. The PLAN score: a bedside prediction rule for death and severe disability following acute ischemic stroke. Arch Intern Med. 2012;172(20):1548-1556. doi:10.1001/2013.jamainternmed.30
Examples
# Example 1: Low Risk
# 55yo, No comorbidities, Alert, Mild Arm Weakness (not significant)
# Score = 0
plan_stroke_score(55, 0, 0, 0, 0, 0, 0, 0, 0)
# Example 2: High Risk
# 85yo (+7), AF (+1), Reduced LOC (+5), Total Arm/Leg Weakness (+4)
# Score = 17
plan_stroke_score(85, 0, 0, 0, 1, 1, 1, 1, 0)
PLASMIC Score for TTP
Description
Calculates the PLASMIC score to predict the likelihood of severe ADAMTS13 deficiency (<10%) in patients with suspected Thrombotic Thrombocytopenic Purpura (TTP). The score is based on 7 clinical and laboratory parameters.
Usage
plasmic_score_ttp(platelet_count, hemolysis_evidence, active_cancer,
stem_cell_or_organ_transplant, mcv_lt_90, inr_lt_1_5,
creatinine_lt_2_0)
Arguments
platelet_count |
Numeric. Platelet count in x10^9/L (or x10^3/uL). (<30 adds 1 point). |
hemolysis_evidence |
Numeric (0 or 1). Evidence of hemolysis (e.g., reticulocyte count >2.5%, undetectable haptoglobin, or indirect bilirubin >2 mg/dL). (1 = Yes, adds 1 point). |
active_cancer |
Numeric (0 or 1). Active cancer (treated within the last year). (0 = No, adds 1 point). |
stem_cell_or_organ_transplant |
Numeric (0 or 1). History of solid organ or hematopoietic stem cell transplant. (0 = No, adds 1 point). |
mcv_lt_90 |
Numeric (0 or 1). Mean Corpuscular Volume (MCV) < 90 fL. (1 = Yes, adds 1 point). |
inr_lt_1_5 |
Numeric (0 or 1). International Normalized Ratio (INR) < 1.5. (1 = Yes, adds 1 point). |
creatinine_lt_2_0 |
Numeric (0 or 1). Serum Creatinine < 2.0 mg/dL. (1 = Yes, adds 1 point). |
Value
A list containing:
PLASMIC_Score |
The calculated total score (Range 0-7). |
Risk_Category |
Risk classification (Low, Intermediate, High). |
TTP_Probability |
Estimated probability of severe ADAMTS13 deficiency. |
References
Bendapudi PK, Hurwitz S, Fry A, et al. Derivation and external validation of the PLASMIC score for rapid assessment of thrombotic microangiopathy: A cohort study. Lancet Haematol. 2017;4(4):e157-e164. doi:10.1016/S2352-3026(17)30026-1
Examples
# Example 1: High Risk
# Plt 20 (<30, +1), Hemolysis (+1), No cancer (+1),
#No transplant (+1), MCV 85 (+1), INR 1.2 (+1), Cr 1.0 (+1)
# Score = 7
plasmic_score_ttp(20, 1, 0, 0, 1, 1, 1)
# Example 2: Low Risk
# Plt 100 (0), Hemolysis (+1), Active cancer (0),
#Transplant (0), MCV 95 (0), INR 1.8 (0), Cr 3.0 (0)
# Score = 1
plasmic_score_ttp(100, 1, 1, 1, 0, 0, 0)
Preoperative Mortality Predictor (PMP) Score
Description
Calculates the Preoperative Mortality Predictor (PMP) Score, a risk stratification tool developed from the ACS-NSQIP database to predict 30-day mortality in general surgery patients. The score sums points assigned to 14 preoperative variables, including age, comorbidities, and functional status.
Usage
pmp_mortality_score(age, inpatient_status, sepsis, poor_functional_status,
disseminated_cancer, cardiac_comorbidity, pulmonary_comorbidity,
renal_comorbidity, liver_comorbidity, steroid_use, weight_loss,
bleeding_disorder, dnr_status, obesity)
Arguments
age |
Numeric. Patient age in years. (<65: 0, 65-69: 0.5, 70-79: 1, >=80: 2). |
inpatient_status |
Numeric (0 or 1). Is the patient an inpatient? (1 = Yes, +6 pts). |
sepsis |
Numeric (0 or 1). Presence of sepsis, severe sepsis, or septic shock within 48 hours prior to surgery. (1 = Yes, +4 pts). |
poor_functional_status |
Numeric (0 or 1). Totally dependent functional status (requires total assistance for all daily activities). (1 = Yes, +3 pts). |
disseminated_cancer |
Numeric (0 or 1). Disseminated cancer. (1 = Yes, +1 pt). |
cardiac_comorbidity |
Numeric (0 or 1). Presence of cardiac comorbidities (History of CHF, MI, Angina, Peripheral Artery Disease, or Hypertension requiring medication). (1 = Yes, +5 pts). |
pulmonary_comorbidity |
Numeric (0 or 1). Presence of pulmonary comorbidities (Ventilator dependence, COPD, or current Pneumonia). (1 = Yes, +3 pts). |
renal_comorbidity |
Numeric (0 or 1). Presence of renal comorbidities (Dialysis or Acute Renal Failure). (1 = Yes, +1 pt). |
liver_comorbidity |
Numeric (0 or 1). Presence of liver comorbidities (Ascites or Esophageal Varices). (1 = Yes, +1 pt). |
steroid_use |
Numeric (0 or 1). Chronic steroid use for a chronic condition. (1 = Yes, +1 pt). |
weight_loss |
Numeric (0 or 1). >10% loss of body weight in the last 6 months. (1 = Yes, +1 pt). |
bleeding_disorder |
Numeric (0 or 1). Presence of a bleeding disorder. (1 = Yes, +1 pt). |
dnr_status |
Numeric (0 or 1). Do Not Resuscitate (DNR) status. (1 = Yes, +1 pt). |
obesity |
Numeric (0 or 1). Obesity (BMI >= 30 kg/m^2). (1 = Yes, -1 pt). |
Value
A list containing:
PMP_Score |
The calculated total risk score. |
Interpretation |
General interpretation of the score (Higher score indicates higher mortality risk). |
References
Ghanem OM, et al. Predicting risk of death in general surgery patients on the basis of preoperative variables using American College of Surgeons National Surgical Quality Improvement Program data. Perm J. 2012;16(4):9-15. doi:10.7812/TPP/12-019
Examples
# Example 1: High Risk
# 80yo (+2), Inpatient (+6), Cardiac (+5), Sepsis (+4)
# Score = 17
pmp_mortality_score(80, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0)
# Example 2: Low Risk
# 45yo (0), Obesity (-1), No other factors
# Score = -1
pmp_mortality_score(45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)
POMPE-C Tool for Pulmonary Embolism Mortality in Cancer
Description
Calculates the POMPE-C score to stratify the risk of 30-day all-cause mortality in patients with active cancer and acute symptomatic pulmonary embolism (PE). The score uses clinical variables including vital signs, physical exam findings, and do-not-resuscitate (DNR) status.
Usage
pompe_c_score(altered_mental_status, dnr_status, oxygen_saturation, weight_kg,
respiratory_rate, heart_rate, unilateral_leg_swelling)
Arguments
altered_mental_status |
Numeric (0 or 1). Presence of altered mental status (disorientation, stupor, coma). (1 = Yes, +18 pts). |
dnr_status |
Numeric (0 or 1). Do Not Resuscitate (DNR) status established. (1 = Yes, +13 pts). |
oxygen_saturation |
Numeric. Oxygen saturation on room air (%). (< 90% adds 8 pts). |
weight_kg |
Numeric. Body weight in kilograms. (< 70 kg adds 6 pts). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. (>= 24 bpm adds 6 pts). |
heart_rate |
Numeric. Heart rate in beats per minute. (>= 100 bpm adds 5 pts). |
unilateral_leg_swelling |
Numeric (0 or 1). Clinical signs of Deep Vein Thrombosis (unilateral leg swelling). (1 = Yes, -3 pts). |
Value
A list containing:
POMPE_C_Score |
The calculated risk score (Range -3 to 56). |
Risk_Category |
Classification (Low <= 5, Intermediate 6-19, High >= 20). |
Est_30_Day_Mortality |
Estimated 30-day mortality percentage range based on derivation and validation cohorts. |
References
Sanchez O, Carmona L, Nieto JA, et al. Predicting 30-day mortality in patients with cancer and acute symptomatic pulmonary embolism: The POMPE-C tool. J Thromb Haemost. 2014;12(11):1833-1840. doi:10.1111/jth.12716
Examples
# Example 1: High Risk
# DNR (1), SpO2 88%, Weight 60kg, HR 110
# Score = 13 + 8 + 6 + 5 = 32
pompe_c_score(0, 1, 88, 60, 20, 110, 0)
# Example 2: Low Risk
# No risk factors, Leg Swelling present
# Score = -3
pompe_c_score(0, 0, 98, 80, 16, 80, 1)
POSSUM Score for Operative Morbidity and Mortality Risk
Description
Calculates the Physiological and Operative Severity Score for the enUmeration of Mortality and morbidity (POSSUM). This system predicts the risk of morbidity and mortality in surgical patients based on 12 physiological and 6 operative factors.
Usage
possum_risk_score(age, cardiac_signs, respiratory_signs, systolic_bp, pulse, gcs,
hemoglobin, wbc_count, urea, sodium, potassium, ecg_status,
operative_severity, multiple_procedures, total_blood_loss,
peritoneal_soiling, malignancy_status, mode_of_surgery,
urea_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. |
cardiac_signs |
String. "normal", "mild" (diuretics/digoxin/angina/HTN), "moderate" (peripheral edema/warfarin), "severe" (raised JVP/cardiomegaly). |
respiratory_signs |
String. "normal", "mild" (dyspnea on exertion/COPD), "moderate" (limiting dyspnea), "severe" (dyspnea at rest/fibrosis). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
pulse |
Numeric. Pulse rate in bpm. |
gcs |
Numeric. Glasgow Coma Scale score (3-15). |
hemoglobin |
Numeric. Hemoglobin level in g/dL. |
wbc_count |
Numeric. White blood cell count in x10^9/L. |
urea |
Numeric. Blood Urea Nitrogen (BUN) or Urea. |
sodium |
Numeric. Serum Sodium in mmol/L. |
potassium |
Numeric. Serum Potassium in mmol/L. |
ecg_status |
String. "normal", "afib_mild" (AF rate 60-90), "abnormal_rhythm" (>4 ectopics/min, Q waves, ST changes). |
operative_severity |
String. "minor", "moderate", "major", "major_plus". |
multiple_procedures |
String. "1", "2", ">2". |
total_blood_loss |
Numeric. Total blood loss in mL. |
peritoneal_soiling |
String. "none", "minor" (serous fluid), "local_pus", "free_bowel_content" (or generalized pus/blood). |
malignancy_status |
String. "none", "primary" (primary only), "nodal" (nodal metastases), "distant" (distant metastases). |
mode_of_surgery |
String. "elective", "emergency_gt_24h" (resuscitation possible), "emergency_2_24h" (operation needed <24h), "emergency_lt_2h" (immediate surgery). |
urea_units |
String. "mg/dL" (default) or "mmol/L". |
Value
A list containing:
Physiological_Score |
The calculated physiological score (Range 12-88). |
Operative_Severity_Score |
The calculated operative severity score (Range 6-48). |
Predicted_Mortality_Risk |
Estimated percentage risk of mortality. |
Predicted_Morbidity_Risk |
Estimated percentage risk of morbidity. |
References
Copeland GP, Jones D, Walters M. POSSUM: a scoring system for surgical audit. Br J Surg. 1991;78(3):355-360. doi:10.1002/bjs.1800780327
Examples
possum_risk_score(
age = 70,
cardiac_signs = "mild",
respiratory_signs = "normal",
systolic_bp = 140,
pulse = 80,
gcs = 15,
hemoglobin = 13.5,
wbc_count = 8.0,
urea = 20,
sodium = 140,
potassium = 4.2,
ecg_status = "normal",
operative_severity = "major",
multiple_procedures = "1",
total_blood_loss = 400,
peritoneal_soiling = "none",
malignancy_status = "primary",
mode_of_surgery = "elective"
)
Prague C & M Criteria for Barrett's Esophagus
Description
Calculates the Prague C & M classification for characterizing the extent of Barrett's Esophagus. It uses endoscopic measurements (distance from incisors) to determine the circumferential (C) and maximum (M) extent of metaplasia relative to the gastroesophageal junction (GEJ).
Usage
prague_cm_classification(ge_junction_distance_cm,
circumferential_metaplasia_proximal_cm,
max_metaplasia_proximal_cm)
Arguments
ge_junction_distance_cm |
Numeric. Distance from the incisors to the gastroesophageal junction (GEJ) in centimeters. |
circumferential_metaplasia_proximal_cm |
Numeric. Distance from the incisors to the proximal margin of the circumferential metaplasia in centimeters. |
max_metaplasia_proximal_cm |
Numeric. Distance from the incisors to the proximal margin of the maximum extent of metaplasia (tongues/islands) in centimeters. |
Value
A list containing:
Prague_Classification |
The formatted classification string (e.g., "C2M5"). |
C_Length_cm |
The calculated length of the circumferential segment. |
M_Length_cm |
The calculated maximum length of the metaplastic segment. |
References
Sharma P, Dent J, Armstrong D, et al. The Development and Validation of an Endoscopic Grading System for Barrett's Esophagus: The Prague C & M Criteria. Gastroenterology. 2006;131(5):1392-1399. doi:10.1053/j.gastro.2006.08.032
Examples
# Example 1: Long segment
# GEJ at 40cm, Circumferential at 37cm, Max tongue at 32cm
# C = 40-37 = 3, M = 40-32 = 8 -> C3M8
prague_cm_classification(40, 37, 32)
# Example 2: Short segment (No circumferential)
# GEJ at 38cm, Circumferential at 38cm (none), Max tongue at 36cm
# C = 0, M = 2 -> C0M2
prague_cm_classification(38, 38, 36)
Pediatric Respiratory Assessment Measure (PRAM)
Description
Calculates the PRAM score to assess the severity of airway obstruction in pediatric patients (ages 1-17) with acute asthma exacerbations. The score evaluates five clinical signs: suprasternal retractions, scalene muscle contraction, air entry, wheezing, and oxygen saturation.
Usage
pram_score(suprasternal_retractions, scalene_muscle_contraction, air_entry,
wheezing, oxygen_saturation)
Arguments
suprasternal_retractions |
Numeric (0 or 1). Presence of suprasternal retractions. (1 = Present [+2 pts], 0 = Absent). |
scalene_muscle_contraction |
Numeric (0 or 1). Presence of scalene muscle contraction. (1 = Present [+2 pts], 0 = Absent). |
air_entry |
Numeric (0-2). Assessment of air entry. 0: Normal. 1: Decreased at the base. 2: Widespread decrease. |
wheezing |
Numeric (0-3). Assessment of wheezing. 0: Absent. 1: Expiratory only. 2: Inspiratory and Expiratory. 3: Audible without stethoscope or silent chest. |
oxygen_saturation |
Numeric. Oxygen saturation (%) on room air. >= 95%: 0 pts. 92-94%: 1 pt. < 92%: 2 pts. |
Value
A list containing:
PRAM_Score |
The calculated total score (Range 0-12). |
Severity_Classification |
Interpretation of severity (Mild 0-3, Moderate 4-7, Severe 8-12). |
References
Chalut DS, Ducharme FM, Davis GM. The Preschool Respiratory Assessment Measure (PRAM): a responsive index of acute asthma severity. J Pediatr. 2000;137(6):762-768. doi:10.1067/mpd.2000.109119
Examples
# Example 1: Moderate Severity
# Retractions (2), Scalene (0), Air Entry Decreased Base (1), Exp Wheeze (1), SpO2 93% (1)
# Score = 5
pram_score(1, 0, 1, 1, 93)
# Example 2: Severe Severity
# Retractions (2), Scalene (2), Widespread decrease (2), Insp/Exp Wheeze (2), SpO2 90% (2)
# Score = 10
pram_score(1, 1, 2, 2, 90)
PRESET Score for Survival on ECMO
Description
Calculates the PREdiction of Survival on ECMO Therapy (PRESET) Score. This tool predicts in-hospital survival for adult patients placed on venovenous extracorporeal membrane oxygenation (VV-ECMO) for severe acute respiratory failure. It stratifies patients into three risk classes based on admission physiology and pre-ECMO hospital duration.
Usage
preset_ecmo_score(mean_arterial_pressure, lactate, arterial_ph,
platelet_count, hospital_days_pre_ecmo)
Arguments
mean_arterial_pressure |
Numeric. Mean Arterial Pressure (MAP) in mmHg. >100: 0 pts 91-100: 1 pt 81-90: 2 pts 71-80: 3 pts <=70: 4 pts |
lactate |
Numeric. Serum lactate concentration in mmol/L. <=1.5: 0 pts 1.51-3.0: 1 pt 3.01-6.0: 2 pts 6.01-10.0: 3 pts >10.0: 4 pts |
arterial_ph |
Numeric. Arterial pH (pHa). >7.30: 0 pts 7.201-7.30: 1 pt 7.101-7.20: 2 pts <=7.10: 3 pts |
platelet_count |
Numeric. Platelet count in x10^3/uL (or x10^9/L). >200: 0 pts 101-200: 1 pt <=100: 2 pts |
hospital_days_pre_ecmo |
Numeric. Number of days in the hospital before ECMO initiation. <=2: 0 pts 3-7: 1 pt >7: 2 pts |
Value
A list containing:
PRESET_Score |
The calculated score (Range 0-15). |
Risk_Class |
Risk classification (Class I: 0-3, Class II: 4-5, Class III: >=6). |
Est_Hospital_Survival |
Estimated probability of survival to hospital discharge. |
References
Hilder M, Herbstreit F, Adamzik M, et al. Comparison of mortality prediction models in acute respiratory distress syndrome undergoing extracorporeal membrane oxygenation and development of a novel prediction score: the PREdiction of Survival on ECMO Therapy-Score (PRESET-Score). Crit Care. 2017;21(1):301. doi:10.1186/s13054-017-1888-6
Examples
# Example 1: Good Prognosis (Class I)
# MAP 95, Lactate 1.2, pH 7.35, Plt 250, Day 1
# Score = 1 + 0 + 0 + 0 + 0 = 1
preset_ecmo_score(95, 1.2, 7.35, 250, 1)
# Example 2: Poor Prognosis (Class III)
# MAP 65, Lactate 8.0, pH 7.15, Plt 80, Day 8
# Score = 4 + 3 + 2 + 2 + 2 = 13
preset_ecmo_score(65, 8.0, 7.15, 80, 8)
PREVAIL Model for Prostate Cancer Survival
Description
Calculates the Prognostic Index for patients with metastatic castration-resistant prostate cancer (mCRPC) based on the PREVAIL trial data (Armstrong et al., 2017). This model predicts overall survival in men treated with enzalutamide or placebo, utilizing 10 baseline clinical and laboratory factors.
Usage
prevail_prostate_cancer_survival(albumin_g_l, alkaline_phosphatase_u_l,
hemoglobin_g_dl, ldh_u_l,
neutrophil_lymphocyte_ratio,
bone_metastases_gt_10, visceral_disease,
pain_score, psa_ng_ml, months_since_diagnosis)
Arguments
albumin_g_l |
Numeric. Serum Albumin level in g/L. (Note: Convert from g/dL if necessary by multiplying by 10). |
alkaline_phosphatase_u_l |
Numeric. Serum Alkaline Phosphatase (ALP) in U/L. |
hemoglobin_g_dl |
Numeric. Hemoglobin level in g/dL. |
ldh_u_l |
Numeric. Serum Lactate Dehydrogenase (LDH) in U/L. |
neutrophil_lymphocyte_ratio |
Numeric. Absolute Neutrophil Count divided by Absolute Lymphocyte Count (NLR). |
bone_metastases_gt_10 |
Numeric (0 or 1). Are there more than 10 bone metastases? (1 = Yes). |
visceral_disease |
Numeric (0 or 1). Presence of visceral metastases (e.g., liver, lung). (1 = Yes). |
pain_score |
Numeric. Brief Pain Inventory-Short Form (BPI-SF) Item 3: "Rate your worst pain in the last 24 hours" (0-10). |
psa_ng_ml |
Numeric. Prostate Specific Antigen level in ng/mL. |
months_since_diagnosis |
Numeric. Time elapsed since the initial diagnosis of prostate cancer in months. |
Value
A list containing:
Prognostic_Index |
The calculated linear predictor score. |
Risk_Group |
General risk categorization based on the prognostic index. |
References
Armstrong AJ, Lin P, Tombal B, et al. Five-year Survival Prediction and Safety Outcomes with Enzalutamide in Men with Chemotherapy-naive Metastatic Castration-resistant Prostate Cancer from the PREVAIL Trial. Eur Urol. 2017;72(6):811-817. doi:10.1016/j.eururo.2017.07.035
Examples
# Example 1: Low Risk Patient
# Alb 42 g/L, ALP 80, Hb 13.5, LDH 180, NLR 2.5, <10 Bone mets,
#No Visceral, Pain 1, PSA 15, 48 months since Dx
prevail_prostate_cancer_survival(42, 80, 13.5, 180, 2.5, 0, 0, 1, 15, 48)
# Example 2: High Risk Patient
# Alb 30 g/L, ALP 300, Hb 10.0, LDH 400, NLR 6.0, >10 Bone mets,
#Visceral Yes, Pain 6, PSA 150, 12 months since Dx
prevail_prostate_cancer_survival(30, 300, 10.0, 400, 6.0, 1, 1, 6, 150, 12)
PREVENT Risk Score for Cardiovascular Disease Events
Description
Calculates the 10-year risk of total cardiovascular disease (CVD) events using the American Heart Association's PREVENT equations. This model includes predictors such as age, sex, cholesterol, blood pressure, diabetes, smoking, eGFR, and BMI, and accounts for current treatments.
Usage
prevent_cvd_risk(age, sex, total_cholesterol, hdl_cholesterol, systolic_bp,
diabetes, smoking, egfr, bmi, current_treatment_hypertension,
current_treatment_statins)
Arguments
age |
Numeric. Patient age in years (30-79). |
sex |
String. "Male" or "Female". |
total_cholesterol |
Numeric. Total cholesterol (mg/dL or mmol/L). |
hdl_cholesterol |
Numeric. HDL cholesterol (mg/dL or mmol/L). |
systolic_bp |
Numeric. Systolic blood pressure (mmHg). |
diabetes |
Numeric (0 or 1). History of diabetes (1 = Yes). |
smoking |
Numeric (0 or 1). Current smoker (1 = Yes). |
egfr |
Numeric. Estimated Glomerular Filtration Rate (mL/min/1.73m^2). |
bmi |
Numeric. Body Mass Index (kg/m^2). |
current_treatment_hypertension |
Numeric (0 or 1). Currently treated for hypertension (1 = Yes). |
current_treatment_statins |
Numeric (0 or 1). Currently taking statins (1 = Yes). |
Value
A list containing:
PREVENT_Risk_Score_10yr |
Estimated 10-year risk of CVD event. |
Risk_Category |
Risk classification (Low, Borderline, Intermediate, High). |
References
Khan SS, Matsushita K, Sang Y, et al. Development and Validation of the American Heart Association Predicting Risk of Cardiovascular Disease EVENTs (PREVENT) Equations. Circulation. 2023.
Examples
prevent_cvd_risk(
age = 55, sex = "female", total_cholesterol = 200, hdl_cholesterol = 50,
systolic_bp = 130, diabetes = 0, smoking = 0, egfr = 90, bmi = 28,
current_treatment_hypertension = 1, current_treatment_statins = 0
)
PRIEST COVID-19 Clinical Severity Score
Description
Calculates the PRIEST score to triage patients with suspected or confirmed COVID-19 in the emergency department. The score predicts the risk of death or requirement for organ support (intubation, non-invasive ventilation, vasopressors, or renal replacement therapy) within 30 days.
Usage
priest_score(sex, age_years, respiratory_rate, oxygen_saturation, heart_rate,
systolic_bp, temperature, alertness_status, performance_status)
Arguments
sex |
String. "male" (+1) or "female" (0). |
age_years |
Numeric. Patient age. (50-64: +2, 65-79: +3, >=80: +4). |
respiratory_rate |
Numeric. Breaths per minute. (>24: +3, 21-24: +2). |
oxygen_saturation |
Numeric. SpO2 percentage. (<92: +3, 92-93: +2, 94-95: +1). |
heart_rate |
Numeric. Beats per minute. (>130: +3, 111-130: +2, 91-110: +1). |
systolic_bp |
Numeric. Systolic Blood Pressure in mmHg. (<90: +3, 90-100: +2, 101-110: +1). |
temperature |
Numeric. Body temperature in Celsius. (<35.0: +3, 35.0-36.0: +2, 36.1-38.0: 0, 38.1-39.0: +1, >39.0: +2). |
alertness_status |
String. "alert" (0) or "confused_or_not_alert" (+3). |
performance_status |
Numeric (0-4). WHO Performance Status. 0: Unrestricted activity (0). 1-2: Restricted strenuous activity / Capable of self-care but unable to work (+1). 3-4: Limited self-care / Completely disabled (+3). |
Value
A list containing:
PRIEST_Score |
The calculated total score (Range 0-29). |
Risk_Category |
Risk stratification (Low, Medium, High, Very High). |
Outcome_Prediction_30_Day |
Estimated 30-day risk of adverse outcome. |
References
Goodacre S, Thomas B, Sutton L, et al. Derivation and validation of a clinical severity score for acutely ill adults with suspected COVID-19: The PRIEST observational cohort study. PLoS One. 2021;16(1):e0245840. doi:10.1371/journal.pone.0245840
Examples
# Example 1: Low Risk
# Female, 30yo, RR 18, SpO2 98, HR 80, SBP 120, Temp 37, Alert, PS 0
# Score = 0
priest_score("female", 30, 18, 98, 80, 120, 37.0, "alert", 0)
# Example 2: High Risk
# Male (+1), 70yo (+3), RR 22 (+2), SpO2 93 (+2),
#HR 100 (+1), SBP 105 (+1), Temp 38.5 (+1), Alert, PS 2 (+1)
# Score = 12
priest_score("male", 70, 22, 93, 100, 105, 38.5, "alert", 2)
PRIMACY Score for Dilated Cardiomyopathy Genetic Yield
Description
Calculates the PRIMACY (Precision Medicine Study in Cardiomyopathy) score to predict the probability of identifying a pathogenic or likely pathogenic genetic variant in patients with Dilated Cardiomyopathy (DCM). The score utilizes clinical, electrocardiographic, and imaging features to stratify the yield of genetic testing.
Usage
primacy_cardiomyopathy_score(sex, age_at_diagnosis, skeletal_myopathy,
family_history_dcm, low_qrs_voltage,
conduction_defect, lge_on_cmr)
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age_at_diagnosis |
Numeric. Age at the time of DCM diagnosis in years. |
skeletal_myopathy |
Numeric (0 or 1). Presence of clinical skeletal myopathy (e.g., muscle weakness, elevated CK not explained by other causes). (1 = Yes). |
family_history_dcm |
Numeric (0 or 1). Family history of DCM in a first- or second-degree relative. (1 = Yes). |
low_qrs_voltage |
Numeric (0 or 1). Presence of low QRS voltage on ECG (typically < 0.5 mV in limb leads). (1 = Yes). |
conduction_defect |
Numeric (0 or 1). Presence of cardiac conduction system disease (e.g., AV block, LBBB, RBBB). (1 = Yes). |
lge_on_cmr |
Numeric (0 or 1). Presence of Late Gadolinium Enhancement (LGE) on Cardiac MRI. (1 = Yes). |
Value
A list containing:
PRIMACY_Probability |
The estimated percentage probability of a positive genetic test result. |
Interpretation |
General risk categorization (Low, Intermediate, High). |
References
Mazzarotto F, et al. Reevaluating the Genetic Architecture of Dilated Cardiomyopathy: The Precision Medicine Study in Cardiomyopathy (PRIMACY). Circulation. 2020;141(6):387-398. doi:10.1161/CIRCULATIONAHA.119.041603
Examples
# Example 1: High Yield
# Female, 30yo, Family Hx, LGE present
primacy_cardiomyopathy_score("female", 30, 0, 1, 0, 0, 1)
# Example 2: Low Yield
# Male, 65yo, No other risk factors
primacy_cardiomyopathy_score("male", 65, 0, 0, 0, 0, 0)
Prognostic Index (PI) for Cancer Outcomes
Description
Calculates the Prognostic Index (PI), an inflammation-based score used to predict survival in patients with various types of cancer. It is derived from C-reactive protein (CRP) levels and White Blood Cell (WBC) count.
Usage
prognostic_index_cancer(crp_mg_l, wbc_count_x10_9_l)
Arguments
crp_mg_l |
Numeric. Serum C-Reactive Protein level in mg/L. |
wbc_count_x10_9_l |
Numeric. White Blood Cell count in x10^9/L. |
Details
The PI is scored as follows:
-
Score 0: CRP <= 10 mg/L AND WBC <= 11 x 10^9/L.
-
Score 1: CRP > 10 mg/L OR WBC > 11 x 10^9/L (but not both).
-
Score 2: CRP > 10 mg/L AND WBC > 11 x 10^9/L.
Value
A list containing:
PI_Score |
The calculated index score (0, 1, or 2). |
Prognosis_Group |
Risk classification (Good, Intermediate, Poor). |
References
Kasahara A, et al. Clinicopathological biomarkers in advanced lung cancer. Proctor MJ, Morrison DS, Talwar D, et al. A comparison of inflammation-based prognostic scores in patients with cancer. A Glasgow Inflammation Outcome Study. Eur J Cancer. 2011;47(17):2633-2641. doi:10.1016/j.ejca.2011.03.028
Examples
# Example 1: Good Prognosis
# CRP 5, WBC 8
# Score = 0
prognostic_index_cancer(5, 8)
# Example 2: Poor Prognosis
# CRP 20, WBC 15
# Score = 2
prognostic_index_cancer(20, 15)
PROMISE Score for Malignant Pleural Effusion
Description
Calculates the PROMISE (PROgnostic score for Malignant Pleural Effusion) score to predict 3-month mortality and estimate median survival in patients with malignant pleural effusion (MPE). The score combines clinical and laboratory variables including hemoglobin, CRP, WBC, ECOG performance status, and cancer type.
Usage
promise_score_mpe(hemoglobin_g_dl, crp_mg_l, wbc_count, ecog_score, cancer_type)
Arguments
hemoglobin_g_dl |
Numeric. Serum hemoglobin level in g/dL. >= 12: 0 pts. 10 - <12: 1 pt. < 10: 2 pts. |
crp_mg_l |
Numeric. Serum C-Reactive Protein level in mg/L. < 50: 0 pts. 50 - <100: 1 pt. >= 100: 2 pts. |
wbc_count |
Numeric. White Blood Cell count in x10^9/L. < 12: 0 pts. >= 12: 1 pt. |
ecog_score |
Numeric. ECOG Performance Status (0-4). 0-1: 0 pts. 2: 2 pts. 3-4: 4 pts. |
cancer_type |
String. Type of primary cancer. "hematologic", "breast", "gynecologic": 0 pts. "mesothelioma": 4 pts. "lung", "gi", "gu", "sarcoma", "melanoma", "other": 2 pts. |
Value
A list containing:
PROMISE_Score |
The calculated total score (Range 0-13). |
Risk_Group |
Classification (Group A-D). |
Est_3_Month_Survival |
Estimated 3-month survival probability. |
Median_Survival |
Estimated median survival time in days. |
References
Psallidas I, Kanellakis NI, Gerry S, et al. Development and validation of the PROMISE score to predict survival in patients with malignant pleural effusion. Lancet Oncol. 2018;19(7):930-939. doi:10.1016/S1470-2045(18)30294-7
Examples
# Example 1: Low Risk (Group A)
# Hb 13 (0), CRP 10 (0), WBC 6 (0), ECOG 0 (0), Breast CA (0)
# Score = 0
promise_score_mpe(13, 10, 6, 0, "breast")
# Example 2: High Risk (Group C)
# Hb 11 (1), CRP 80 (1), WBC 9 (0), ECOG 2 (2), Lung CA (2)
# Score = 6
promise_score_mpe(11, 80, 9, 2, "lung")
Prostate Tumor Volume and PSA Density Calculator
Description
Calculates the estimated prostate volume using the ellipsoid formula (Length x Width x Height x 0.52) and the PSA density (PSA / Prostate Volume). These metrics are useful in the evaluation of prostate cancer risk, particularly in distinguishing between benign prostatic hyperplasia (BPH) and prostate cancer.
Usage
prostate_tumor_volume_density(prostate_length_cm, prostate_width_cm,
prostate_height_cm, psa_ng_ml)
Arguments
prostate_length_cm |
Numeric. Length of the prostate in centimeters (measured via ultrasound or MRI). |
prostate_width_cm |
Numeric. Width of the prostate in centimeters. |
prostate_height_cm |
Numeric. Height of the prostate in centimeters. |
psa_ng_ml |
Numeric. Serum Prostate Specific Antigen (PSA) level in ng/mL. |
Value
A list containing:
Prostate_Volume_cc |
The estimated prostate volume in cubic centimeters (cc) or milliliters (mL). |
PSA_Density_ng_ml_cc |
The calculated PSA density. Values > 0.15 ng/mL/cc are often considered more suspicious for prostate cancer. |
References
Terris MK, Stamey TA. Determination of prostate volume by transrectal ultrasound. J Urol. 1991;145(5):984-987. doi:10.1016/s0022-5347(17)38508-7
Examples
# Example 1: High Density (Suspicious)
# Prostate 4x4x3 cm, PSA 10
# Vol = 0.52 * 4 * 4 * 3 = 24.96 cc
# Density = 10 / 24.96 = 0.40
prostate_tumor_volume_density(4, 4, 3, 10)
# Example 2: Low Density (Likely BPH)
# Prostate 5x6x5 cm, PSA 4
# Vol = 0.52 * 5 * 6 * 5 = 78 cc
# Density = 4 / 78 = 0.05
prostate_tumor_volume_density(5, 6, 5, 4)
PSA Doubling Time (PSADT) Calculator
Description
Calculates the PSA Doubling Time, a kinetic measure of prostate cancer growth, using linear regression of the natural logarithm of PSA over time. This metric is commonly used to assess prognosis and guide treatment in patients with biochemical recurrence after definitive therapy.
Usage
psa_doubling_time(psa_date1, psa_value1, psa_date2, psa_value2,
psa_date3 = NULL, psa_value3 = NULL)
Arguments
psa_date1 |
Date string (YYYY-MM-DD). Date of the first PSA measurement. |
psa_value1 |
Numeric. First PSA value in ng/mL. |
psa_date2 |
Date string (YYYY-MM-DD). Date of the second PSA measurement. |
psa_value2 |
Numeric. Second PSA value in ng/mL. |
psa_date3 |
Date string (YYYY-MM-DD) (Optional). Date of the third PSA measurement. |
psa_value3 |
Numeric (Optional). Third PSA value in ng/mL. |
Details
The calculation performs a linear regression of \ln(PSA) versus time (in months). The doubling time is calculated as \frac{\ln(2)}{slope}. At least two data points are required, but three provide a more robust estimate.
Value
A list containing:
PSA_Doubling_Time_Months |
The estimated time in months for the PSA level to double. |
References
Pound CR, Partin AW, Eisenberger MA, Chan DW, Pearson JD, Walsh PC. Natural history of progression after PSA elevation following radical prostatectomy. JAMA. 1999;281(17):1591-1597. doi:10.1001/jama.281.17.1591
Examples
# Example 1: Two points
# Jan 1: PSA 4.0, July 1: PSA 8.0 (6 months later)
# Should double in approx 6 months
psa_doubling_time("2023-01-01", 4.0, "2023-07-01", 8.0)
# Example 2: Three points
# Jan: 2.0, Apr: 3.0, Jul: 4.5
psa_doubling_time("2023-01-01", 2.0, "2023-04-01", 3.0, "2023-07-01", 4.5)
Pneumonia Severity Index (PSI/PORT) Score
Description
Calculates the Pneumonia Severity Index (PSI), also known as the PORT Score, to stratify patients with community-acquired pneumonia (CAP) into risk classes (I-V) based on demographics, comorbidities, physical exam findings, and laboratory results. This helps determine the appropriate site of care (outpatient vs. inpatient).
Usage
psi_port_score(age, sex, nursing_home, neoplastic_disease, liver_disease,
congestive_heart_failure, cerebrovascular_disease, renal_disease,
altered_mental_status, respiratory_rate, systolic_bp, temperature_c,
heart_rate, arterial_ph, bun_mg_dl, sodium_mmol_l, glucose_mg_dl,
hematocrit_percent, pao2_mmhg, pleural_effusion, sao2_percent = NULL)
Arguments
age |
Numeric. Patient age in years. |
sex |
String. Patient sex ("Male" or "Female"). |
nursing_home |
Numeric (0 or 1). Nursing home resident. (1 = Yes, +10 pts). |
neoplastic_disease |
Numeric (0 or 1). Active neoplastic disease. (1 = Yes, +30 pts). |
liver_disease |
Numeric (0 or 1). History of liver disease. (1 = Yes, +20 pts). |
congestive_heart_failure |
Numeric (0 or 1). History of congestive heart failure. (1 = Yes, +10 pts). |
cerebrovascular_disease |
Numeric (0 or 1). History of cerebrovascular disease. (1 = Yes, +10 pts). |
renal_disease |
Numeric (0 or 1). History of renal disease. (1 = Yes, +10 pts). |
altered_mental_status |
Numeric (0 or 1). Altered mental status (disorientation, stupor, coma). (1 = Yes, +20 pts). |
respiratory_rate |
Numeric. Respiratory rate in breaths/min. (>= 30: +20 pts). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. (< 90: +20 pts). |
temperature_c |
Numeric. Temperature in Celsius. (< 35 or >= 40: +15 pts). |
heart_rate |
Numeric. Pulse in beats/min. (>= 125: +10 pts). |
arterial_ph |
Numeric. Arterial pH. (< 7.35: +30 pts). |
bun_mg_dl |
Numeric. Blood Urea Nitrogen in mg/dL. (>= 30: +20 pts). |
sodium_mmol_l |
Numeric. Serum Sodium in mmol/L. (< 130: +20 pts). |
glucose_mg_dl |
Numeric. Glucose in mg/dL. (>= 250: +10 pts). |
hematocrit_percent |
Numeric. Hematocrit percentage. (< 30: +10 pts). |
pao2_mmhg |
Numeric. Arterial partial pressure of oxygen in mmHg. (< 60: +10 pts). |
pleural_effusion |
Numeric (0 or 1). Presence of pleural effusion on imaging. (1 = Yes, +10 pts). |
sao2_percent |
Numeric (Optional). Oxygen saturation percentage. Used if PaO2 is not available. (< 90 |
Value
A list containing:
PSI_Score |
The calculated total score. |
Risk_Class |
The risk classification (II-V). |
Mortality_Risk |
Estimated mortality percentage. |
Recommendation |
Suggested site of care. |
References
Fine MJ, Auble TE, Yealy DM, et al. A prediction rule to identify low-risk patients with community-acquired pneumonia. N Engl J Med. 1997;336(4):243-250. doi:10.1056/NEJM199701233360402
Examples
# Example 1: Low Risk
# 40yo Male, No comorbidities, Normal Vitals/Labs
# Score = 40
psi_port_score(40, "male", 0, 0, 0, 0, 0, 0, 0, 16, 120, 37, 70, 7.4, 15, 140, 90, 40, 90, 0)
# Example 2: High Risk
# 70yo Female (-10), Nursing Home (+10), CHF (+10), RR 32 (+20), BUN 40 (+20)
# Score = 60 + 10 + 10 + 20 + 20 = 120 (Class IV)
psi_port_score(70, "female", 1, 0, 0, 1, 0, 0, 0, 32, 110, 37, 80, 7.4, 40, 140, 100, 40, 80, 0)
ED-SAFE Patient Safety Screener 3 (PSS-3)
Description
Implements the Patient Safety Screener-3 (PSS-3), a brief 3-item tool used in emergency departments and acute care settings to screen for suicide risk. It assesses depressed mood, active suicidal ideation, and lifetime suicide attempts.
Usage
pss_3_screener(depressed_2weeks, suicidal_thoughts_2weeks,
suicide_attempt_lifetime)
Arguments
depressed_2weeks |
Numeric (0 or 1). Over the past 2 weeks, have you felt down, depressed, or hopeless? (1 = Yes). |
suicidal_thoughts_2weeks |
Numeric (0 or 1). Over the past 2 weeks, have you had thoughts of killing yourself? (1 = Yes). |
suicide_attempt_lifetime |
Numeric (0 or 1). In your lifetime, have you ever attempted to kill yourself? (1 = Yes). |
Value
A list containing:
Screen_Result |
"Positive" or "Negative" regarding suicide risk. |
Risk_Interpretation |
Specific context on whether the screen flags suicide risk or depression only. |
Recommended_Action |
Suggested clinical next steps (e.g., secondary screening, safety planning). |
References
Boudreaux ED, Camargo CA Jr, Arias SA, et al. Improving Suicide Risk Screening and Detection in the Emergency Department. Am J Prev Med. 2016;50(4):445-453. doi:10.1016/j.amepre.2015.09.029
Examples
# Example 1: Suicide Risk Positive (Thoughts)
# Depressed (1), Thoughts (1), No Attempt (0)
pss_3_screener(1, 1, 0)
# Example 2: Depression Only (Suicide Risk Negative)
# Depressed (1), No Thoughts (0), No Attempt (0)
pss_3_screener(1, 0, 0)
# Example 3: Negative Screen
# No to all
pss_3_screener(0, 0, 0)
Pediatric Ulcerative Colitis Activity Index (PUCAI)
Description
Calculates the PUCAI score to assess disease activity in pediatric patients with ulcerative colitis. The score is based on six clinical items: abdominal pain, rectal bleeding, stool consistency, number of stools per 24 hours, nocturnal stools, and activity level limitation.
Usage
pucai_score(abdominal_pain, rectal_bleeding, stool_consistency, stools_per_24h,
nocturnal_stools, activity_level)
Arguments
abdominal_pain |
Numeric. Score for abdominal pain: 0 (None), 5 (Ignoreable), 10 (Severe). |
rectal_bleeding |
Numeric. Score for rectal bleeding: 0 (None), 10 (Small amount/ <50% of stools), 20 (Large amount/ >=50% of stools), 30 (Daily). Note: Specific point assignments vary slightly by source definition (e.g., 0, 10, 20, 30 is common). |
stool_consistency |
Numeric. Score for stool consistency: 0 (Formed), 5 (Partially formed), 10 (Completely unformed). |
stools_per_24h |
Numeric. Score for number of stools per 24 hours: 0 (0-2), 5 (3-5), 10 (6-8), 15 (>8). |
nocturnal_stools |
Numeric. Score for nocturnal stools: 0 (No), 10 (Yes). |
activity_level |
Numeric. Score for activity level: 0 (No limitation), 5 (Occasional limitation), 10 (Severe limitation). |
Value
A list containing:
PUCAI_Score |
The calculated total score (Range 0-85). |
Disease_Activity |
Classification of disease severity (Remission <10, Mild 10-34, Moderate 35-64, Severe >=65). |
References
Turner D, Otley AR, Mack D, et al. Development, validation, and evaluation of a pediatric ulcerative colitis activity index: a prospective multicenter study. Gastroenterology. 2007;133(2):423-432. doi:10.1053/j.gastro.2007.05.012
Examples
# Example 1: Mild Disease
# Pain(5), Bleeding(10), Consistency(5), Freq(0), Nocturnal(0), Activity(0)
# Score = 20
pucai_score(5, 10, 5, 0, 0, 0)
# Example 2: Severe Disease
# Pain(10), Bleeding(30), Consistency(10), Freq(15), Nocturnal(10), Activity(10)
# Score = 85
pucai_score(10, 30, 10, 15, 10, 10)
Quick COVID-19 Severity Index (qCSI)
Description
Calculates the qCSI score to predict the 24-hour risk of critical respiratory illness (defined as high-flow oxygen, non-invasive ventilation, intubation, or death) in patients admitted with COVID-19. The score relies on three bedside variables: respiratory rate, pulse oximetry, and oxygen flow rate.
Usage
qcsi_score(respiratory_rate, oxygen_saturation, o2_flow_rate)
Arguments
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. <= 22: 0 pts. 23-28: 1 pt. > 28: 2 pts. |
oxygen_saturation |
Numeric. Minimum documented pulse oximetry (SpO2) percent. > 92: 0 pts. 89-92: 2 pts. <= 88: 5 pts. |
o2_flow_rate |
Numeric. Oxygen flow rate in Liters per minute (L/min) at the time of minimum SpO2. 0 (Room air): 0 pts. 1-2 L/min: 4 pts. 3-4 L/min: 5 pts. >= 5 L/min: 6 pts. |
Value
A list containing:
qCSI_Score |
The calculated total score (Range 0-12). |
Risk_Category |
Risk classification (Low, Low-Intermediate, High-Intermediate, High). |
Est_24hr_Critical_Illness_Risk |
Estimated probability of critical illness within 24 hours. |
References
Haimovich AD, Ravindra NG, Stoytchev S, et al. Development and Validation of the Quick COVID-19 Severity Index: A Prognostic Tool for Early Clinical Decompensation. Ann Emerg Med. 2020;76(4):442-453. doi:10.1016/j.annemergmed.2020.07.022
Examples
# Example 1: Low Risk
# RR 18, SpO2 95%, Room Air (0L)
# Score = 0
qcsi_score(18, 95, 0)
# Example 2: High Risk
# RR 30 (+2), SpO2 88% (+5), 4L O2 (+5)
# Score = 12
qcsi_score(30, 88, 4)
Quick Inventory of Depressive Symptomatology (QIDS-SR16)
Description
Calculates the QIDS total score based on 16 items that assess the severity of depressive symptoms. The scoring logic groups the 16 items into 9 clinical domains (matching DSM criteria), taking the highest score within a specific domain (e.g., Sleep, Appetite/Weight, Psychomotor) as the score for that domain.
Usage
qids_depression_score(sleep_onset, sleep_mid_nocturnal, sleep_early_waking,
sleep_hypersomnia, mood_sadness, appetite_decreased,
appetite_increased, weight_decreased, weight_increased,
concentration, view_of_self, thoughts_death_suicide,
general_interest, energy_level, psychomotor_slowing,
psychomotor_agitation)
Arguments
sleep_onset |
Numeric (0-3). Q1: Falling asleep. |
sleep_mid_nocturnal |
Numeric (0-3). Q2: Sleep during the night. |
sleep_early_waking |
Numeric (0-3). Q3: Waking up too early. |
sleep_hypersomnia |
Numeric (0-3). Q4: Sleeping too much. |
mood_sadness |
Numeric (0-3). Q5: Feeling sad. |
appetite_decreased |
Numeric (0-3). Q6: Decreased appetite. |
appetite_increased |
Numeric (0-3). Q7: Increased appetite. |
weight_decreased |
Numeric (0-3). Q8: Decreased weight (within last 2 weeks). |
weight_increased |
Numeric (0-3). Q9: Increased weight (within last 2 weeks). |
concentration |
Numeric (0-3). Q10: Concentration / Decision making. |
view_of_self |
Numeric (0-3). Q11: View of myself. |
thoughts_death_suicide |
Numeric (0-3). Q12: Thoughts of death or suicide. |
general_interest |
Numeric (0-3). Q13: General interest. |
energy_level |
Numeric (0-3). Q14: Energy level. |
psychomotor_slowing |
Numeric (0-3). Q15: Feeling slowed down. |
psychomotor_agitation |
Numeric (0-3). Q16: Feeling restless. |
Value
A list containing:
QIDS_Total_Score |
The sum of the 9 domain scores (Range 0-27). |
Severity_Category |
Interpretation (None, Mild, Moderate, Severe, Very Severe). |
Domain_Scores |
The specific scores calculated for the 9 domains. |
References
Rush AJ, Trivedi MH, Ibrahim HM, et al. The 16-Item Quick Inventory of Depressive Symptomatology (QIDS), clinician rating (QIDS-C), and self-report (QIDS-SR): a psychometric evaluation in patients with chronic major depression. Biol Psychiatry. 2003;54(5):573-583. doi:10.1016/s0006-3223(02)01866-8
Examples
# Example 1: Severe Depression
# High scores in sleep (max 3), sadness (3), energy (3), suicide (1)
qids_depression_score(3, 2, 1, 0, 3, 0, 0, 0, 0, 2, 2, 1, 2, 3, 1, 0)
# Example 2: Normal
# All items 0
qids_depression_score(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
quick SOFA (qSOFA) Score for Sepsis
Description
Calculates the quick Sequential Organ Failure Assessment (qSOFA) score. This bedside tool identifies patients with suspected infection who are at greater risk for a poor outcome (prolonged ICU stay or in-hospital mortality) outside the intensive care unit. It uses three clinical criteria: respiratory rate, altered mental status, and systolic blood pressure.
Usage
qsofa_sepsis_score(respiratory_rate, systolic_bp, gcs_score)
Arguments
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. (>= 22 adds 1 point). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. (<= 100 adds 1 point). |
gcs_score |
Numeric. Glasgow Coma Scale score (3-15). (Any score < 15 indicates altered mental status and adds 1 point). |
Value
A list containing:
qSOFA_Score |
The calculated score (Range 0-3). |
Risk_Category |
"High Risk" if Score >= 2, otherwise "Low Risk". |
Interpretation |
Clinical guidance based on the risk level. |
References
Singer M, Deutschman CS, Seymour CW, et al. The Third International Consensus Definitions for Sepsis and Septic Shock (Sepsis-3). JAMA. 2016;315(8):801-810. doi:10.1001/jama.2016.0287
Examples
# Example 1: High Risk Sepsis
# RR 24 (+1), SBP 95 (+1), GCS 14 (+1)
# Score = 3
qsofa_sepsis_score(24, 95, 14)
# Example 2: Low Risk
# RR 18, SBP 120, GCS 15
# Score = 0
qsofa_sepsis_score(18, 120, 15)
Rapid Arterial Occlusion Evaluation (RACE) Scale for Stroke
Description
Calculates the RACE Scale score to identify patients with acute stroke who are likely to have a Large Vessel Occlusion (LVO). This prehospital tool assesses 5 distinct neurological domains to help triage patients to the appropriate stroke center for endovascular treatment.
Usage
race_stroke_scale(facial_palsy, arm_motor, leg_motor, head_gaze_deviation,
aphasia_or_agnosia)
Arguments
facial_palsy |
Numeric (0-2). 0: Absent. 1: Mild (droop). 2: Moderate to Severe (paralysis). |
arm_motor |
Numeric (0-2). Motor function of the affected arm. 0: Normal to Mild (holds > 10s). 1: Moderate (holds < 10s). 2: Severe (does not raise or creates no effort). |
leg_motor |
Numeric (0-2). Motor function of the affected leg. 0: Normal to Mild (holds > 5s). 1: Moderate (holds < 5s). 2: Severe (does not raise or creates no effort). |
head_gaze_deviation |
Numeric (0-1). Head and gaze deviation. 0: Absent. 1: Present (eyes or head deviated to one side). |
aphasia_or_agnosia |
Numeric (0-2). Assessment of cortical signs based on the side of hemiparesis. If Right Hemiparesis (Left Hemisphere), assess Aphasia (Naming/Orders). If Left Hemiparesis (Right Hemisphere), assess Agnosia (Arm/Anosognosia). 0: Normal. 1: Moderate. 2: Severe. |
Value
A list containing:
RACE_Score |
The calculated total score (Range 0-9). |
Interpretation |
Likelihood of LVO (Score >= 5 indicates high probability). |
Performance_at_Cutoff_5 |
Sensitivity and specificity metrics for LVO detection at the threshold of 5. |
References
Pérez de la Ossa N, Carrera D, Gorchs M, et al. Design and validation of a prehospital stroke scale to predict large arterial occlusion: the rapid arterial occlusion evaluation scale. Stroke. 2014;45(1):87-91. doi:10.1161/STROKEAHA.113.003071
Examples
# Example 1: High Probability of LVO
# Moderate Face (2), Severe Arm (2), Severe Leg (2), Gaze (1), Severe Aphasia (2)
# Score = 9
race_stroke_scale(2, 2, 2, 1, 2)
# Example 2: Lower Probability
# Mild Face (1), Moderate Arm (1), Normal Leg (0), No Gaze (0), No Agnosia (0)
# Score = 2
race_stroke_scale(1, 1, 0, 0, 0)
Radiation Biologically Effective Dose (BED) Calculator
Description
Calculates the Biologically Effective Dose (BED) and the Equivalent Dose in 2 Gy fractions (EQD2) using the linear-quadratic model. This allows for the comparison of different radiation fractionation schedules by normalizing them to a biologically equivalent dose based on tissue sensitivity (alpha/beta ratio).
Usage
radiation_bed_calculator(dose_per_fraction_gy, number_of_fractions, alpha_beta_ratio)
Arguments
dose_per_fraction_gy |
Numeric. The radiation dose delivered per fraction in Gray (Gy). |
number_of_fractions |
Numeric. The total number of fractions in the treatment schedule. |
alpha_beta_ratio |
Numeric. The alpha/beta ratio for the specific tissue or tumor type. Common values: 10 Gy for early-responding tissues and most tumors. 3 Gy for late-responding tissues (e.g., spinal cord, lung). 1.5-3 Gy for prostate cancer. |
Value
A list containing:
BED_Gy |
The Biologically Effective Dose. |
EQD2_Gy |
The equivalent total dose if delivered in 2 Gy fractions. |
Total_Physical_Dose_Gy |
The total physical dose delivered. |
References
Fowler JF. The linear-quadratic formula and progress in fractionated radiotherapy. Br J Radiol. 1989;62(740):679-694. doi:10.1259/0007-1285-62-740-679
Examples
# Example 1: Standard Fractionation (Tumor Control)
# 2 Gy x 30 fractions, a/b = 10
# Total = 60 Gy. BED = 60 * (1 + 2/10) = 72 Gy10.
radiation_bed_calculator(2, 30, 10)
# Example 2: SBRT (Tumor Control)
# 20 Gy x 3 fractions, a/b = 10
# Total = 60 Gy. BED = 60 * (1 + 20/10) = 180 Gy10.
radiation_bed_calculator(20, 3, 10)
# Example 3: Late Toxicity Check (Spinal Cord)
# 3 Gy x 10 fractions (Palliative), a/b = 3
# Total = 30 Gy. BED = 30 * (1 + 3/3) = 60 Gy3.
radiation_bed_calculator(3, 10, 3)
RADS (Radiologists Score) for Smoke Inhalation Injury
Description
Calculates the RADS score to stratify the severity of smoke inhalation injury based on chest CT findings. The chest CT slice is divided into four quadrants, and each quadrant is scored based on the worst finding present. The total score for the slice ranges from 0 to 12. High scores (>8) are associated with a significantly increased risk of pneumonia, ARDS, and death.
Usage
rads_smoke_inhalation_score(quadrant1_finding, quadrant2_finding,
quadrant3_finding, quadrant4_finding)
Arguments
quadrant1_finding |
String. Finding in the 1st quadrant. Options: "normal" (0 pts), "interstitial" (Increased interstitial markings, 1 pt), "ground_glass" (Ground glass opacification, 2 pts), "consolidation" (3 pts). |
quadrant2_finding |
String. Finding in the 2nd quadrant. Options: "normal", "interstitial", "ground_glass", "consolidation". |
quadrant3_finding |
String. Finding in the 3rd quadrant. Options: "normal", "interstitial", "ground_glass", "consolidation". |
quadrant4_finding |
String. Finding in the 4th quadrant. Options: "normal", "interstitial", "ground_glass", "consolidation". |
Value
A list containing:
RADS_Score |
The calculated total score (Range 0-12). |
Risk_Category |
Interpretation ("Lower Risk" <= 8, "High Risk" > 8). |
References
Yamamura H, Kaga S, Kaneda K, et al. Chest computed tomography performed on admission helps predict the severity of smoke-inhalation injury. Crit Care. 2013;17(3):R95. doi:10.1186/cc12740
Examples
# Example 1: Severe Injury
# Consolidation in all quadrants
rads_smoke_inhalation_score("consolidation", "consolidation", "consolidation", "consolidation")
# Example 2: Mild/Moderate Injury
# Interstitial markings in 2 quadrants, Ground glass in 2
rads_smoke_inhalation_score("interstitial", "interstitial", "ground_glass", "ground_glass")
Rai Staging System for Chronic Lymphocytic Leukemia (CLL)
Description
Calculates the Rai Stage for patients with Chronic Lymphocytic Leukemia (CLL). This staging system stratifies patients into Low, Intermediate, and High risk groups based on the presence of lymphocytosis, lymphadenopathy, organomegaly (hepatomegaly or splenomegaly), anemia, and thrombocytopenia.
Usage
rai_cll_staging(lymphocytosis, lymphadenopathy, organomegaly,
hemoglobin_lt_11, platelets_lt_100)
Arguments
lymphocytosis |
Numeric (0 or 1). Presence of absolute lymphocytosis (>5,000/uL in blood and >=30% in marrow). (1 = Yes). |
lymphadenopathy |
Numeric (0 or 1). Presence of lymphadenopathy. (1 = Yes). |
organomegaly |
Numeric (0 or 1). Presence of hepatomegaly or splenomegaly. (1 = Yes). |
hemoglobin_lt_11 |
Numeric (0 or 1). Hemoglobin < 11 g/dL (Anemia). (1 = Yes). |
platelets_lt_100 |
Numeric (0 or 1). Platelets < 100,000/uL (Thrombocytopenia). (1 = Yes). |
Value
A list containing:
Rai_Stage |
The calculated stage (0, I, II, III, or IV). |
Risk_Category |
Risk stratification (Low, Intermediate, High). |
Median_Survival |
Historical median survival estimates based on the original 1975 cohort data. |
References
Rai KR, Sawitsky A, Cronkite EP, et al. Clinical staging of chronic lymphocytic leukemia. Blood. 1975;46(2):219-234.
Examples
# Example 1: High Risk (Stage IV)
# Lymphocytosis, Anemia, Thrombocytopenia
rai_cll_staging(1, 1, 1, 1, 1)
# Example 2: Low Risk (Stage 0)
# Lymphocytosis only
rai_cll_staging(1, 0, 0, 0, 0)
Ranson's Criteria for Pancreatitis Mortality
Description
Calculates the Ranson's Criteria score to predict the mortality risk of patients with acute pancreatitis. The score evaluates 11 parameters measured at admission and at 48 hours. Different scoring thresholds apply depending on whether the pancreatitis is biliary (gallstone-induced) or non-biliary (e.g., alcoholic).
Usage
ransons_criteria(age, wbc_count, glucose_mg_dl, ldh, ast,
hct_fall_percent, bun_increase_mg_dl, calcium_mg_dl,
pao2_mmhg, base_deficit_meq_l, fluid_sequestration_liters,
etiology = "non_biliary")
Arguments
age |
Numeric. Patient age in years. |
wbc_count |
Numeric. White Blood Cell count (cells/mm^3 or uL). |
glucose_mg_dl |
Numeric. Blood glucose level in mg/dL. |
ldh |
Numeric. Lactate Dehydrogenase level in IU/L. |
ast |
Numeric. Aspartate Aminotransferase level in IU/L. |
hct_fall_percent |
Numeric. Drop in hematocrit percentage points within 48 hours. |
bun_increase_mg_dl |
Numeric. Increase in Blood Urea Nitrogen in mg/dL within 48 hours. |
calcium_mg_dl |
Numeric. Serum Calcium level in mg/dL at 48 hours. |
pao2_mmhg |
Numeric. Arterial PO2 in mmHg at 48 hours. (Only scored for non-biliary etiology in standard Ranson's, though often collected). |
base_deficit_meq_l |
Numeric. Base deficit in mEq/L at 48 hours. |
fluid_sequestration_liters |
Numeric. Estimated fluid sequestration in Liters at 48 hours. |
etiology |
String. Cause of pancreatitis. Options: "non_biliary" (default) or "biliary". |
Value
A list containing:
Ranson_Score |
The calculated total score (Range 0-11 for non-biliary, 0-10 for biliary). |
Mortality_Risk |
Estimated mortality percentage associated with the score. |
References
Ranson JH, Rifkind KM, Roses DF, et al. Prognostic signs and the role of operative management in acute pancreatitis. Surg Gynecol Obstet. 1974;139(1):69-81. Ranson JH. Etiological and prognostic factors in human acute pancreatitis: a review. Am J Gastroenterol. 1982;77(9):633-638.
Examples
# Example 1: Non-Biliary (Alcohol), Severe
# Age 60 (+1), WBC 18k (+1), Glu 250 (+1), LDH 400 (+1), AST 300 (+1)
# 48h: Hct drop 12 (+1), BUN up 10 (+1), Ca 7 (+1), PaO2 55 (+1), BD 5 (+1), Fluid 7 (+1)
# Score = 11
ransons_criteria(60, 18000, 250, 400, 300, 12, 10, 7, 55, 5, 7, "non_biliary")
# Example 2: Biliary, Moderate
# Age 75 (+1), WBC 19k (+1), Glu 150 (0), LDH 350 (0), AST 200 (0)
# 48h: Hct drop 5 (0), BUN up 1 (0), Ca 9 (0), PaO2 70, BD 2 (0), Fluid 3 (0)
# Score = 2
ransons_criteria(75, 19000, 150, 350, 200, 5, 1, 9, 70, 2, 3, "biliary")
RAPID Score for Acetabular Chondrolabral Disruption
Description
Calculates the Rapidly Assessed Predictor of Intraoperative Damage (RAPID) score. This preoperative scoring system predicts the presence of high-grade acetabular labrum articular disruption (ALAD grade 3 or 4) in patients undergoing hip arthroscopy for femoroacetabular impingement.
Usage
rapid_acetabular_score(sex, tonnis_grade, cam_morphology)
Arguments
sex |
String. Patient sex ("Male" or "Female"). Male sex adds 1 point. |
tonnis_grade |
Numeric (0-2). Tönnis classification of osteoarthritis. 0: No signs of OA (0 points). 1: Increased sclerosis, slight narrowing/lipping (+2 points). 2: Small cysts, moderate narrowing, loss of sphericity (+3 points). Note: Grade 3 is a contraindication to arthroscopy and not scored. |
cam_morphology |
Numeric (0 or 1). Presence of Cam morphology, defined as an alpha angle > 55 degrees. (1 = Present/Yes, +1 point). |
Value
A list containing:
RAPID_Score |
The calculated total score (Range 0-5). |
Risk_Prediction |
Estimated probability of finding high-grade chondral damage intraoperatively. |
References
Nwachukwu BU, Chang B, Rotter B, et al. The Rapidly Assessed Predictor of Intraoperative Damage (RAPID) Score: An In-Clinic Predictive Model for High-Grade Acetabular Chondrolabral Disruption. Am J Sports Med. 2019;47(2):395-400. doi:10.1177/0363546518813091
Examples
# Example 1: High Risk Candidate
# Male (+1), Tonnis Grade 1 (+2), Cam Present (+1)
# Score = 4
rapid_acetabular_score("male", 1, 1)
# Example 2: Low Risk Candidate
# Female (0), Tonnis Grade 0 (0), Cam Absent (0)
# Score = 0
rapid_acetabular_score("female", 0, 0)
RAPID Score for Pleural Infection
Description
Calculates the RAPID Score to predict 3-month mortality in patients with pleural infection. The acronym RAPID stands for Renal (BUN), Age, Purulence, Infection Source, and Diet (Albumin).
Usage
rapid_pleural_infection_score(bun, age, purulent_fluid, hospital_acquired,
albumin, bun_units = "mg/dL", albumin_units = "g/dL")
Arguments
bun |
Numeric. Blood Urea Nitrogen level. <14 mg/dL: 0 pts. 14-23 mg/dL: 1 pt. >23 mg/dL: 2 pts. |
age |
Numeric. Patient age in years. <50: 0 pts. 50-70: 1 pt. >70: 2 pts. |
purulent_fluid |
Numeric (0 or 1). Is the pleural fluid purulent? (1 = Yes, 0 = No). Note: Non-purulent fluid adds 1 point. |
hospital_acquired |
Numeric (0 or 1). Is the infection hospital-acquired? (1 = Yes, +1 pt). |
albumin |
Numeric. Serum Albumin level. (<2.7 g/dL adds 1 point). |
bun_units |
String. Units for BUN. "mg/dL" (default) or "mmol/L". |
albumin_units |
String. Units for Albumin. "g/dL" (default) or "g/L". |
Value
A list containing:
RAPID_Score |
The calculated total score (Range 0-7). |
Risk_Category |
Classification (Low 0-2, Medium 3-4, High 5-7). |
Est_3_Month_Mortality |
Estimated 3-month mortality percentage. |
References
Rahman NM, Maskell NA, West A, et al. Intrapleural use of tissue plasminogen activator and DNase in pleural infection. N Engl J Med. 2011;365(6):518-526. doi:10.1056/NEJMoa1012740 White HD, Henry C, Stockgmayer S, et al. A Proposal for a New Scoring System to Predict Mortality in Patients With Pleural Infection. Chest. 2015;148:19S.
Examples
# Example 1: Low Risk
# BUN 10, Age 40, Purulent(Yes), Community(0), Alb 3.5
# Score = 0 + 0 + 0 + 0 + 0 = 0
rapid_pleural_infection_score(10, 40, 1, 0, 3.5)
# Example 2: High Risk
# BUN 30 (+2), Age 75 (+2), Non-purulent (+1), Hospital (+1), Alb 2.0 (+1)
# Score = 7
rapid_pleural_infection_score(30, 75, 0, 1, 2.0)
HIV Needle Stick Risk Assessment Stratification Protocol (RASP)
Description
Estimates the risk of HIV transmission following occupational exposure (needle stick, mucous membrane, or non-intact skin contact) and provides Post-Exposure Prophylaxis (PEP) recommendations based on CDC guidelines.
Usage
rasp_hiv_risk(source_status, exposure_type, deep_injury_or_visible_blood,
source_viral_load_high)
Arguments
source_status |
String. Status of the source patient. Options: "positive", "negative", "unknown". |
exposure_type |
String. Type of exposure. Options: "percutaneous" (needle stick/cut), "mucous_membrane" (splash to eye/mouth), "non_intact_skin" (abrasion/dermatitis). |
deep_injury_or_visible_blood |
Numeric (0 or 1). Was the injury deep or was there visible blood on the device? (1 = Yes). |
source_viral_load_high |
Numeric (0 or 1). Is the source known to have a high viral load or acute HIV infection? (1 = Yes). |
Value
A list containing:
Estimated_Transmission_Risk |
The estimated probability of seroconversion (e.g., 0.3% for percutaneous). |
PEP_Recommendation |
Guidance on initiating Post-Exposure Prophylaxis. |
References
Kuhar DT, Henderson DK, Struble KA, et al. Updated US Public Health Service Guidelines for the Management of Occupational Exposures to Human Immunodeficiency Virus and Recommendations for Postexposure Prophylaxis. Infect Control Hosp Epidemiol. 2013;34(9):875-892. doi:10.1086/672271
Examples
# Example 1: High Risk Needlestick
# Source Positive, Percutaneous, Deep injury
rasp_hiv_risk("positive", "percutaneous", 1, 1)
# Example 2: Lower Risk Splash
# Source Positive, Mucous membrane splash
rasp_hiv_risk("positive", "mucous_membrane", 0, 0)
# Example 3: Source Negative
# No risk
rasp_hiv_risk("negative", "percutaneous", 1, 0)
RBC Units to Screen for Compatibility
Description
Calculates the estimated number of red blood cell (RBC) units that need to be screened to find a specified number of antigen-negative units for a patient with red cell alloantibodies. The calculation uses standard antigen-negative prevalence rates (based on a predominantly Caucasian population data from the AABB).
Usage
rbc_compatibility_screen(units_needed, antigens_selected)
Arguments
units_needed |
Numeric. The number of compatible units required for transfusion. |
antigens_selected |
Character vector. A list of antigens for which the donor units must be negative. Supported codes: "d" (RhD), "c_big" (C), "c_little" (c), "e_big" (E), "e_little" (e), "k_big" (K/Kell), "k_little" (k/Cellano), "fya" (Duffy a), "fyb" (Duffy b), "jka" (Kidd a), "jkb" (Kidd b), "lea" (Lewis a), "leb" (Lewis b), "m", "n", "s_big" (S), "s_little" (s), "p1". |
Details
The formula is:
Units\_to\_Screen = \frac{Units\_Needed}{P_1 \times P_2 \times ... \times P_n}
Where P is the prevalence of antigen-negative donors in the population for each selected antibody.
Value
A list containing:
Units_to_Screen |
The estimated number of units to crossmatch (rounded up). |
Combined_Antigen_Negative_Frequency |
The mathematical probability of finding a unit negative for all selected antigens. |
References
Fung MK, et al. AABB Technical Manual. 18th ed. Bethesda, MD: AABB; 2014.
Examples
# Example 1: Anti-K and Anti-E
# K negative freq ~91%, E negative freq ~71%
# Need 2 units: 2 / (0.91 * 0.71) = 3.1 -> 4 units
rbc_compatibility_screen(2, c("k_big", "e_big"))
# Example 2: Multiple Antibodies (Anti-c, Anti-Fya)
# c negative ~20%, Fya negative ~34%
# Need 2 units: 2 / (0.20 * 0.34) = 29.4 -> 30 units
rbc_compatibility_screen(2, c("c_little", "fya"))
RCVS2 Score for Reversible Cerebral Vasoconstriction Syndrome
Description
Calculates the RCVS2 score to distinguish Reversible Cerebral Vasoconstriction Syndrome (RCVS) from other intracranial arteriopathies (e.g., Primary Angiitis of the CNS) in adult patients (18-55 years) presenting with abnormal intracranial vascular imaging.
Usage
rcvs2_score(recurrent_thunderclap_headache, carotid_artery_involvement,
vasoconstrictive_trigger, sex, subarachnoid_hemorrhage)
Arguments
recurrent_thunderclap_headache |
Numeric (0 or 1). Presence of recurrent or single thunderclap headache. (1 = Yes, +5 points). |
carotid_artery_involvement |
Numeric (0 or 1). Is the intracranial carotid artery affected? (1 = Yes, -2 points). |
vasoconstrictive_trigger |
Numeric (0 or 1). Was a vasoconstrictive trigger identified (e.g., vasoactive medications, postpartum state, illicit drugs)? (1 = Yes, +3 points). |
sex |
String. Patient sex ("Male" or "Female"). (Female = +1 point, Male = 0 points). |
subarachnoid_hemorrhage |
Numeric (0 or 1). Is subarachnoid hemorrhage present on imaging? (1 = Yes, +1 point). |
Value
A list containing:
RCVS2_Score |
The calculated total score (Range -2 to 10). |
Risk_Category |
Classification of likelihood (Low <=2, Equivocal 3-4, High >=5). |
Interpretation |
Diagnostic guidance based on the score. |
References
Rocha EA, Topcuoglu MA, Silva GS, Singhal AB. RCVS2 score and diagnostic approach for reversible cerebral vasoconstriction syndrome. Neurology. 2019;92(7):e639-e647. doi:10.1212/WNL.0000000000006917
Examples
# Example 1: High Likelihood
# Recurrent TCH (+5), Female (+1), Trigger (+3), No Carotid (0), No SAH (0)
# Score = 9
rcvs2_score(1, 0, 1, "female", 0)
# Example 2: Low Likelihood
# No TCH (0), Carotid involved (-2), No Trigger (0), Male (0), No SAH (0)
# Score = -2
rcvs2_score(0, 1, 0, "male", 0)
Respiratory Distress Observation Scale (RDOS)
Description
Calculates the RDOS score to assess respiratory distress in patients who are unable to self-report dyspnea (e.g., cognitive impairment, intubation, end-of-life). The score ranges from 0 to 16, with higher scores indicating greater distress.
Usage
rdos_score(heart_rate, respiratory_rate, restlessness, paradoxical_breathing,
accessory_muscle_use, grunting, nasal_flaring, look_of_fear)
Arguments
heart_rate |
Numeric. Heart rate in beats per minute. <90: 0 pts. 90-109: 1 pt. >=110: 2 pts. |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. <=18: 0 pts. 19-30: 1 pt. >30: 2 pts. |
restlessness |
String. "none" (0 pts), "occasional" (slight movements, 1 pt), "frequent" (movements, 2 pts). |
paradoxical_breathing |
Numeric (0 or 1). Abdomen moves in on inspiration. (1 = Yes, +2 pts). |
accessory_muscle_use |
String. Rise in clavicles during inspiration. "none" (0 pts), "slight" (1 pt), "pronounced" (2 pts). |
grunting |
Numeric (0 or 1). Guttural sound at end-expiration. (1 = Yes, +2 pts). |
nasal_flaring |
Numeric (0 or 1). Involuntary movement of nares. (1 = Yes, +2 pts). |
look_of_fear |
Numeric (0 or 1). Eyes wide open, facial muscles tense, brow furrowed, mouth open, teeth together. (1 = Yes, +2 pts). |
Value
A list containing:
RDOS_Score |
The calculated total score (Range 0-16). |
Interpretation |
Assessment of distress (e.g., <3: No distress, >=3: Distress requiring palliation). |
References
Campbell ML, Templin T, Walch J. A Respiratory Distress Observation Scale for patients unable to self-report dyspnea. J Palliat Med. 2010;13(3):285-290. doi:10.1089/jpm.2009.0229
Examples
# Example 1: Severe Distress
# HR 120 (+2), RR 35 (+2), Frequent Restless (+2), Paradoxical (+2),
# Pronounced Accessory (+2), Grunting (+2), Flaring (+2), Fear (+2)
# Score = 16
rdos_score(120, 35, "frequent", 1, "pronounced", 1, 1, 1)
# Example 2: No Distress
# HR 70 (0), RR 16 (0), No signs
# Score = 0
rdos_score(70, 16, "none", 0, "none", 0, 0, 0)
REACH-B Score for Hepatocellular Carcinoma (HCC) Risk
Description
Calculates the REACH-B (Risk Estimation for Hepatocellular Carcinoma in Chronic Hepatitis B) score. This tool estimates the risk of developing HCC at 3, 5, and 10 years in patients with chronic hepatitis B without cirrhosis. It incorporates gender, age, ALT levels, HBeAg status, and serum HBV DNA levels.
Usage
reach_b_score(sex, age, alt_u_l, hbeag_positive, hbv_dna, dna_units = "IU/mL")
Arguments
sex |
String. Patient sex ("Male" or "Female"). Male adds 2 points. |
age |
Numeric. Patient age in years. (Points range from 0 for 30-34y to 7 for >=65y). |
alt_u_l |
Numeric. Serum Alanine Aminotransferase (ALT) level in U/L. (<15: 0, 15-44: 1, >=45: 2). |
hbeag_positive |
Numeric (0 or 1). Hepatitis B e-Antigen status. (1 = Positive, +2 points). |
hbv_dna |
Numeric. Serum HBV DNA level. |
dna_units |
String. Units for HBV DNA input. Options: "IU/mL" (default) or "copies/mL". (Conversion: 1 IU/mL approx 5 copies/mL). |
Value
A list containing:
REACH_B_Score |
The calculated risk score (Range 0-17). |
HCC_Risk_3_Year |
Estimated 3-year risk of developing HCC. |
HCC_Risk_5_Year |
Estimated 5-year risk of developing HCC. |
HCC_Risk_10_Year |
Estimated 10-year risk of developing HCC. |
References
Yang HI, Yuen MF, Chan HL, et al. Risk estimation for hepatocellular carcinoma in chronic hepatitis B (REACH-B): development and validation of a predictive score. Lancet Oncol. 2011;12(6):568-574. doi:10.1016/S1470-2045(11)70077-8
Examples
# Example 1: High Risk Male
# 50yo, ALT 50, HBeAg+, DNA 10^6 copies/mL
# Score: Male(2) + Age 50(4) + ALT(2) + HBeAg(2) + DNA(4) = 14
reach_b_score("male", 50, 50, 1, 1000000, "copies/mL")
# Example 2: Low Risk Female
# 35yo, ALT 10, HBeAg-, DNA 2000 IU/mL (10^4 copies)
# Score: Female(0) + Age 35(1) + ALT(0) + HBeAg(0) + DNA(3) = 4
reach_b_score("female", 35, 10, 0, 2000, "IU/mL")
READMITS Score for Readmissions after Acute MI
Description
Calculates the READMITS score to predict the risk of 30-day hospital readmission following an Acute Myocardial Infarction (AMI). The mnemonic stands for: Renal, Elevated BNP, Age, Diabetes, Male, Intervention (lack of), Therapies (lack of), and Systolic BP (low).
Usage
readmits_score_ami(age, sex, creatinine, bnp, diabetes, pci_performed,
optimal_therapies, systolic_bp)
Arguments
age |
Numeric. Patient age in years. (65-74: +1, >=75: +2). |
sex |
String. Patient sex ("Male" or "Female"). (Male: +1). |
creatinine |
Numeric. Serum creatinine in mg/dL. (> 1.2 mg/dL: +1). |
bnp |
Numeric. B-type Natriuretic Peptide in pg/mL. (> 200 pg/mL: +1). |
diabetes |
Numeric (0 or 1). History of Diabetes Mellitus. (1 = Yes, +1). |
pci_performed |
Numeric (0 or 1). Was Percutaneous Coronary Intervention (PCI) performed during the index admission? (0 = No, +1). |
optimal_therapies |
Numeric (0 or 1). Was the patient discharged on all appropriate evidence-based therapies (e.g., Aspirin, Beta-blocker, ACEi/ARB, Statin)? (0 = No/Incomplete, +1). |
systolic_bp |
Numeric. Systolic blood pressure on admission in mmHg. (< 100 mmHg: +1). |
Value
A list containing:
READMITS_Score |
The calculated score (Range 0-9). |
Risk_Category |
Classification (Low, Intermediate, High). |
Est_30_Day_Readmission |
Estimated percentage risk of readmission within 30 days. |
References
Li Y, et al. A Simple Risk Score to Predict 30-Day Readmission After Acute Myocardial Infarction. (Contextual validation based on mnemonic factors).
Examples
# Example 1: High Risk
# 76yo Male (+2 Age, +1 Sex), Cr 1.5 (+1), BNP 400 (+1), No PCI (+1), SBP 90 (+1)
# Score = 7
readmits_score_ami(76, "male", 1.5, 400, 0, 0, 1, 90)
# Example 2: Low Risk
# 50yo Female, Normal labs, PCI done, Optimal meds, SBP 120
# Score = 0
readmits_score_ami(50, "female", 0.8, 50, 0, 1, 1, 120)
Rebound Hyperbilirubinemia Risk Score
Description
Calculates the risk of rebound hyperbilirubinemia (return of total serum bilirubin to phototherapy threshold within 72 hours) after discontinuation of inpatient phototherapy in neonates >= 35 weeks gestation. The score uses gestational age, age at phototherapy initiation, and the difference between the AAP phototherapy threshold and the TSB level at termination.
Usage
rebound_hyperbilirubinemia_score(gestational_age_weeks, age_initiation_hours,
tsb_termination_mg_dl, aap_threshold_mg_dl)
Arguments
gestational_age_weeks |
Numeric. Gestational age in weeks (Must be >= 35). |
age_initiation_hours |
Numeric. Postnatal age in hours at the time phototherapy was initiated. |
tsb_termination_mg_dl |
Numeric. Total Serum Bilirubin level (mg/dL) at the time of phototherapy discontinuation. |
aap_threshold_mg_dl |
Numeric. The AAP phototherapy treatment threshold (mg/dL) for the infant at the time of discontinuation. |
Value
A list containing:
Rebound_Score |
The calculated risk score. |
Rebound_Risk_Probability |
Estimated probability of rebound hyperbilirubinemia. |
References
Chang PW, Kuzniewicz MW, McCulloch CE, Newman TB. A Clinical Prediction Rule for Rebound Hyperbilirubinemia Following Inpatient Phototherapy. Pediatrics. 2017;139(3):e20162896. doi:10.1542/peds.2016-2896
Examples
# Example 1: Low Risk
# 39 weeks, Started at 48 hours, TSB 12, Threshold 16 (Diff 4)
# Score = 0 - 7(2) - 4(4) + 50 = -14 - 16 + 50 = 20
rebound_hyperbilirubinemia_score(39, 48, 12, 16)
# Example 2: High Risk
# 36 weeks (<38), Started at 24 hours, TSB 13, Threshold 14 (Diff 1)
# Score = 15 - 7(1) - 4(1) + 50 = 15 - 7 - 4 + 50 = 54
rebound_hyperbilirubinemia_score(36, 24, 13, 14)
RegiSCAR Score for DRESS Syndrome
Description
Calculates the RegiSCAR score to diagnose Drug Reaction with Eosinophilia and Systemic Symptoms (DRESS). The score evaluates clinical features including fever, lymphadenopathy, hematologic abnormalities, skin involvement, organ involvement, and exclusion of other causes.
Usage
regiscar_dress_score(fever_gt_385, lymphadenopathy, eosinophil_count,
atypical_lymphocytes, skin_extent_gt_50,
skin_suggestive_features, organ_involvement_count,
other_causes_excluded, resolution_gt_15_days = 1)
Arguments
fever_gt_385 |
Numeric (0 or 1). Fever > 38.5 degrees Celsius. (1 = Yes, +1 point). |
lymphadenopathy |
Numeric (0 or 1). Enlarged lymph nodes in >= 2 sites (> 1 cm). (1 = Yes, +1 point). |
eosinophil_count |
Numeric. Absolute Eosinophil Count (cells/uL). (>= 700: +1, >= 1500: +2). |
atypical_lymphocytes |
Numeric (0 or 1). Presence of atypical lymphocytes. (1 = Yes, +1 point). |
skin_extent_gt_50 |
Numeric (0 or 1). Skin rash extent > 50% body surface area. (1 = Yes, +1 point). |
skin_suggestive_features |
Numeric (0 or 1). Presence of at least 2 suggestive skin features (e.g., infiltration, purpura, scaling, facial edema). (1 = Yes, +1 point). |
organ_involvement_count |
Numeric. Number of internal organs involved (e.g., liver, kidney, lung). (1 organ: +1, >=2 organs: +2). |
other_causes_excluded |
Numeric (0 or 1). Were other potential causes (e.g., viral infections, ANA, blood culture) excluded? (1 = Yes, +1 point). |
resolution_gt_15_days |
Numeric (0 or 1). Did the reaction last more than 15 days? (1 = Yes, 0 pts; 0 = No, -1 point). Defaults to 1 (Yes) as DRESS is typically persistent. |
Value
A list containing:
RegiSCAR_Score |
The calculated total score. |
Diagnosis |
Diagnostic classification (No, Possible, Probable, or Definite DRESS). |
References
Kardaun SH, Sidoroff A, Valeyrie-Allanore L, et al. Variability in the clinical pattern of cutaneous side-effects of drugs with systemic symptoms: does a DRESS syndrome really exist? Br J Dermatol. 2007;156(3):609-611. doi:10.1111/j.1365-2133.2006.07704.x
Examples
# Example 1: Probable DRESS
# Fever(+1), Eos 900(+1), Atypical Lymphs(+1), Rash >50%(+1), No organs(0)
# Score = 4
regiscar_dress_score(1, 0, 900, 1, 1, 0, 0, 0, 1)
# Example 2: Definite DRESS
# Fever(+1), Nodes(+1), Eos 2000(+2), Rash Feat(+1), Liver/Kidney(+2)
# Score = 7
regiscar_dress_score(1, 1, 2000, 0, 0, 1, 2, 0, 1)
Reid's Colposcopic Index (RCI)
Description
Calculates the Reid's Colposcopic Index (RCI) score to grade the severity of premalignant cervical lesions during colposcopy. The score is based on four colposcopic signs: lesion margin, color of acetowhitening, vascular patterns, and iodine staining response.
Usage
reids_colposcopic_index(lesion_margin, acetowhitening_color, vascular_patterns,
iodine_staining)
Arguments
lesion_margin |
Numeric (0-2). Characteristics of the lesion margin. 0: Condylomatous or micropapillary contour; indistinct, flocculated, or feathered margins; jagged/angular lesions; satellite lesions beyond the transformation zone. 1: Regular lesions with smooth, straight outlines. 2: Rolled, peeling edges; internal borders between areas of differing appearance. |
acetowhitening_color |
Numeric (0-2). Color of the lesion after acetic acid application. 0: Shiny, snow-white; indistinct acetowhitening; semitransparent. 1: Shiny, off-white; intermediate white; gray-white. 2: Dull, oyster gray; dense/opaque acetowhitening. |
vascular_patterns |
Numeric (0-2). Characteristics of blood vessels within the lesion. 0: Uniform, fine-caliber vessels; poorly formed patterns; nondilated capillary loops. 1: Absence of surface vessels after acetic acid soaking. 2: Definite, coarse punctation or mosaicism; dilated vessels arranged in well-defined patterns. |
iodine_staining |
Numeric (0-2). Response to Lugol's iodine solution. 0: Positive iodine uptake (mahogany brown); or negative uptake (mustard yellow) in a lesion scoring <=2 points on the first three criteria. 1: Partial iodine uptake; variegated/tortoise-shell appearance. 2: Negative iodine uptake (mustard yellow) in a lesion scoring >=3 points on the first three criteria. |
Value
A list containing:
RCI_Score |
The calculated total score (Range 0-8). |
Predicted_Histology |
Predicted histologic grade (Low, Intermediate, or High grade). |
References
Reid R, Scalzi P. Genital warts and cervical cancer. VII. An improved colposcopic index for differentiating benign papillomaviral infections from high-grade cervical intraepithelial neoplasia. Am J Obstet Gynecol. 1985;153(6):611-618. doi:10.1016/0002-9378(85)90245-2
Examples
# Example 1: High Grade Lesion
# Rolled edges (2), Dull gray (2), Coarse mosaic (2), Negative iodine (2)
# Score = 8
reids_colposcopic_index(2, 2, 2, 2)
# Example 2: Low Grade Lesion
# Irregular margin (0), Snow white (0), Fine vessels (0), Positive iodine (0)
# Score = 0
reids_colposcopic_index(0, 0, 0, 0)
Relative Fat Mass (RFM)
Description
Calculates the Relative Fat Mass (RFM), an estimator of whole-body fat percentage based on the ratio of height to waist circumference. It has been shown to be more accurate than BMI for diagnosing obesity.
Usage
relative_fat_mass(sex, height, waist, units = "cm")
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
height |
Numeric. Height. (Units must match waist). |
waist |
Numeric. Waist circumference. (Units must match height). |
units |
String. Units of measurement (e.g., "cm" or "in"). Used for display only; the ratio is unit-independent as long as both inputs match. |
Details
The formula is:
Men:
64 - (20 \times \frac{Height}{Waist})Women:
76 - (20 \times \frac{Height}{Waist})
Cutoffs for obesity are typically cited as \ge 22.8% for men and \ge 33.9% for women.
Value
A list containing:
RFM_Percentage |
The estimated body fat percentage. |
Interpretation |
Classification as Obese or Non-Obese based on validation cutoffs. |
References
Woolcott OO, Bergman RN. Relative fat mass (RFM) as a new estimator of whole-body fat percentage A cross-sectional study in American adult individuals. Sci Rep. 2018;8(1):10980. doi:10.1038/s41598-018-29362-1
Examples
# Example 1: Male
# Height 180 cm, Waist 90 cm (Ratio 2.0)
# RFM = 64 - (20 * 2) = 24%
relative_fat_mass("male", 180, 90)
# Example 2: Female
# Height 165 cm, Waist 80 cm (Ratio 2.06)
# RFM = 76 - (20 * 2.06) = 34.8%
relative_fat_mass("female", 165, 80)
Spanish Network on Mastocytosis (REMA) Score
Description
Calculates the REMA Score to predict the presence of clonal mast cell disease (Systemic Mastocytosis or Monoclonal Mast Cell Activation Syndrome) in patients with mast cell activation symptoms but without skin lesions (systemic mastocytosis sine urticaria pigmentosa). A score of 2 or higher suggests a higher probability of clonality and may warrant bone marrow biopsy.
Usage
rema_mastocytosis_score(sex, clinical_symptoms, tryptase_level)
Arguments
sex |
String. Patient sex ("male" or "female"). Male: +2 points. Female: -4 points. |
clinical_symptoms |
String. The primary clinical presentation. "pruritus_urticaria_angioedema": Pruritus, urticaria, or angioedema (-4 points). "syncope_presyncope": Syncope or presyncope (+3 points). "anaphylaxis": Anaphylaxis (+1 point). "other": Other symptoms (0 points). |
tryptase_level |
Numeric. Baseline serum tryptase level in ng/mL. < 15: 0 points. 15 - 24.9: +1 point. >= 25: +2 points. |
Value
A list containing:
REMA_Score |
The calculated total score (Range -8 to +7). |
Prediction |
Interpretation of probability (Low < 2, High >= 2). |
Test_Characteristics_at_Cutoff_2 |
Sensitivity and Specificity metrics. |
References
Alvarez-Twose I, González-de-Olano D, Sánchez-Muñoz L, et al. Clinical, biological, and molecular characteristics of clonal mast cell disorders presenting with systemic mast cell activation symptoms. J Allergy Clin Immunol. 2010;125(6):1269-1278.e2. doi:10.1016/j.jaci.2010.02.019
Examples
# Example 1: High Probability
# Male (+2), Syncope (+3), Tryptase 20 (+1)
# Score = 6
rema_mastocytosis_score("male", "syncope_presyncope", 20)
# Example 2: Low Probability
# Female (-4), Urticaria (-4), Tryptase 10 (0)
# Score = -8
rema_mastocytosis_score("female", "pruritus_urticaria_angioedema", 10)
Rapid Emergency Medicine Score (REMS)
Description
Calculates the Rapid Emergency Medicine Score (REMS) to predict in-hospital mortality in non-surgical emergency department patients. The score is an adaptation of the APACHE II score but relies on only six readily available parameters: age, heart rate, respiratory rate, systolic blood pressure, Glasgow Coma Scale (GCS), and oxygen saturation.
Usage
rems_score(age_years, heart_rate, respiratory_rate, systolic_bp, gcs_score,
oxygen_saturation)
Arguments
age_years |
Numeric. Patient age in years. |
heart_rate |
Numeric. Heart rate in beats per minute. |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
gcs_score |
Numeric. Glasgow Coma Scale score (3-15). |
oxygen_saturation |
Numeric. Peripheral oxygen saturation (SpO2) percentage. |
Value
A list containing:
REMS_Score |
The calculated total score (Range 0-26). |
Mortality_Risk |
Estimated mortality risk category. |
References
Olsson T, Terent A, Lind L. Rapid Emergency Medicine Score: a new prognostic tool for in-hospital mortality in nonsurgical emergency department patients. J Intern Med. 2004;255(5):579-587. doi:10.1111/j.1365-2796.2004.01321.x
Examples
# Example 1: Low Risk
# 40yo, HR 80, RR 16, SBP 120, GCS 15, SpO2 98
# Score = 0
rems_score(40, 80, 16, 120, 15, 98)
# Example 2: High Risk
# 70yo (+5), HR 120 (+2), RR 28 (+2), SBP 100 (0), GCS 12 (+2), SpO2 88 (+1)
# Score = 12
rems_score(70, 120, 28, 100, 12, 88)
RENAL Nephrometry Score
Description
Calculates the RENAL Nephrometry Score to quantify the anatomical complexity of renal masses. This system aids in surgical decision-making (e.g., partial vs. radical nephrectomy) and outcomes prediction. The acronym stands for Radius, Exophytic/Endophytic, Nearness to collecting system, Anterior/Posterior, and Location relative to polar lines.
Usage
renal_nephrometry_score(radius_cm, exophytic_percent, nearness_collecting_system_mm,
anterior_posterior, location_polar_lines)
Arguments
radius_cm |
Numeric. Radius (maximal diameter) of the tumor in centimeters. <=4: 1 pt. >4-<7: 2 pts. >=7: 3 pts. |
exophytic_percent |
Numeric. Percentage of the tumor that is exophytic. >=50%: 1 pt. <50%: 2 pts. Endophytic: 3 pts. |
nearness_collecting_system_mm |
Numeric. Distance of the tumor to the collecting system or sinus in millimeters. >=7mm: 1 pt. >4mm-<7mm: 2 pts. <=4mm: 3 pts. |
anterior_posterior |
String. Location relative to the coronal plane. Options: "anterior" (a), "posterior" (p), "neither" (x). |
location_polar_lines |
String. Location relative to the polar lines. "entirely_above_below": Entirely above upper or below lower polar line (1 pt). "crosses_polar_line": Crosses polar line (2 pts). "gt_50_percent_across_polar_line_or_axial": >50% of mass is across polar line, or crosses axial renal midline, or entirely between polar lines (3 pts). |
Value
A list containing:
RENAL_Score |
The formatted score (e.g., "4a", "10p"). |
Complexity_Level |
Classification (Low 4-6, Moderate 7-9, High 10-12). |
References
Kutikov A, Uzzo RG. The R.E.N.A.L. nephrometry score: a comprehensive standardized system for quantitating renal tumor size, location and depth. J Urol. 2009;182(3):844-853. doi:10.1016/j.juro.2009.05.035
Examples
# Example 1: Low Complexity
# 3cm, 60% exophytic, 8mm from sinus, Anterior, Above polar line
# Score: 1+1+1+1 = 4a
renal_nephrometry_score(3, 60, 8, "anterior", "entirely_above_below")
# Example 2: High Complexity
# 5cm, Endophytic, Touching sinus (0mm), Posterior, Crossing midline
# Score: 2+3+3+3 = 11p
renal_nephrometry_score(5, 0, 0, "posterior", "gt_50_percent_across_polar_line_or_axial")
RESCUE-IHCA Score for ECPR Survival
Description
Calculates the RESCUE-IHCA score to predict the probability of survival to hospital discharge in patients with in-hospital cardiac arrest (IHCA) who are being considered for Extracorporeal Cardiopulmonary Resuscitation (ECPR). The score stratifies patients based on age, renal history, time of arrest, initial rhythm, and etiology.
Usage
rescue_ihca_score(age, history_renal_insufficiency, time_of_arrest_day,
initial_rhythm_shockable, etiology_cardiac)
Arguments
age |
Numeric. Patient age in years. <60: +6 pts. 60-74: +2 pts. >=75: 0 pts. |
history_renal_insufficiency |
Numeric (0 or 1). History of renal insufficiency (e.g., creatinine > 1.5 mg/dL or CKD). (1 = Yes, -2 pts). |
time_of_arrest_day |
Numeric (0 or 1). Did the arrest occur during daytime hours (08:00 to 16:59)? (1 = Yes, +2 pts). |
initial_rhythm_shockable |
Numeric (0 or 1). Was the initial rhythm shockable (VF or pVT)? (1 = Yes, +2 pts). |
etiology_cardiac |
Numeric (0 or 1). Is the etiology of the arrest primary cardiac (Medical-Cardiac or Surgical-Cardiac)? (1 = Yes, +4 pts). Note: Non-cardiac etiologies score 0. |
Value
A list containing:
RESCUE_IHCA_Score |
The calculated score (Range -2 to 16). |
Est_Survival_to_Discharge |
Estimated probability of survival to hospital discharge based on the derivation cohort. |
References
Schmidt M, Burstein B, Ho EC, et al. Predicting Survival for Patients With In-Hospital Cardiac Arrest Undergoing Extracorporeal Cardiopulmonary Resuscitation: The RESCUE-IHCA Score. JACC: Clinical Electrophysiology. 2020;6(13):1630-1638.
Examples
# Example 1: Good Candidate
# 50yo (+6), No Renal, Day Arrest (+2), VF (+2), Cardiac Cause (+4)
# Score = 14
rescue_ihca_score(50, 0, 1, 1, 1)
# Example 2: Poor Candidate
# 78yo (0), Renal Hx (-2), Night Arrest (0), PEA (0), Non-Cardiac (0)
# Score = -2
rescue_ihca_score(78, 1, 0, 0, 0)
RESECT-90 Score for Lung Resection Mortality
Description
Calculates the RESECT-90 score to estimate the 90-day risk of mortality in patients undergoing lung resection (e.g., lobectomy, pneumonectomy). The model is a multivariable logistic regression derived from a large UK cohort (Taylor et al., 2021). It incorporates patient demographics, comorbidities, and surgical factors.
Usage
resect90_lung_mortality_score(age, sex, ecog_ps, dlco_percent, bmi, creatinine,
anemia, arrhythmia, right_sided_resection,
thoracotomy_approach, malignant_diagnosis,
num_resected_segments, creatinine_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. |
sex |
String. "Male" or "Female". (Male sex is associated with higher risk). |
ecog_ps |
Numeric. Eastern Cooperative Oncology Group (ECOG) performance status (0-4). |
dlco_percent |
Numeric. Percentage predicted diffusion capacity of the lung for carbon monoxide (DLCO). |
bmi |
Numeric. Body Mass Index in kg/m^2. (Higher BMI is associated with lower risk in this model). |
creatinine |
Numeric. Serum creatinine level. |
anemia |
Numeric (0 or 1). Presence of preoperative anemia. (1 = Yes). |
arrhythmia |
Numeric (0 or 1). History of preoperative arrhythmia (e.g., Atrial Fibrillation). (1 = Yes). |
right_sided_resection |
Numeric (0 or 1). Is the surgery a right-sided resection? (1 = Yes). |
thoracotomy_approach |
Numeric (0 or 1). Is the surgery performed via open thoracotomy (vs VATS/Robotic)? (1 = Yes). |
malignant_diagnosis |
Numeric (0 or 1). Is the resection for a malignant diagnosis? (1 = Yes). |
num_resected_segments |
Numeric. Number of bronchopulmonary segments resected (e.g., Lobectomy ~3-5, Pneumonectomy ~10). |
creatinine_units |
String. Units for creatinine. "mg/dL" (default) or "umol/L". |
Value
A list containing:
RESECT90_Score_Percent |
The estimated percentage probability of death within 90 days of surgery. |
Interpretation |
Brief context for the result. |
References
Taylor M, et al. Development and internal validation of a clinical prediction model for 90-day mortality after lung resection: the RESECT-90 score. Interact Cardiovasc Thorac Surg. 2021.
Examples
resect90_lung_mortality_score(
age = 70,
sex = "male",
ecog_ps = 1,
dlco_percent = 60,
bmi = 25,
creatinine = 1.0,
anemia = 0,
arrhythmia = 0,
right_sided_resection = 1,
thoracotomy_approach = 1,
malignant_diagnosis = 1,
num_resected_segments = 3
)
RESP Score for ECMO Survival Prediction
Description
Calculates the Respiratory Extracorporeal Membrane Oxygenation Survival Prediction (RESP) score. This tool predicts in-hospital survival for adult patients undergoing ECMO for severe Acute Respiratory Distress Syndrome (ARDS). It stratifies patients into five risk classes based on 12 pre-ECMO variables.
Usage
resp_ecmo_score(age, immunocompromised, mv_duration_hours, diagnosis_category,
cns_dysfunction, acute_infection_non_pulm, neuromuscular_blockade,
nitric_oxide_use, bicarbonate_use, cardiac_arrest, paco2_mmhg,
pip_cmh2o)
Arguments
age |
Numeric. Patient age in years. 18-49: 0 pts. 50-59: -2 pts. >=60: -3 pts. |
immunocompromised |
Numeric (0 or 1). Immunocompromised status (hematological malignancy, solid tumor, solid organ transplant, HIV, cirrhosis). (1 = Yes, -2 pts). |
mv_duration_hours |
Numeric. Duration of mechanical ventilation prior to ECMO initiation in hours. < 48 hours: +3 pts. 48 hours - 7 days: +1 pt. > 7 days: 0 pts. |
diagnosis_category |
String. Primary acute respiratory diagnosis. "viral_pneumonia", "bacterial_pneumonia", "aspiration_pneumonitis", "trauma_burn": +3 pts. "asthma": +11 pts. "other_acute_respiratory" (e.g., inhalation injury, alveolar hemorrhage): +1 pt. "chronic_non_respiratory" (e.g., chronic lung disease, non-respiratory cause): 0 pts. |
cns_dysfunction |
Numeric (0 or 1). Central nervous system dysfunction (neurotrauma, stroke, encephalopathy, seizure). (1 = Yes, -7 pts). |
acute_infection_non_pulm |
Numeric (0 or 1). Acute associated non-pulmonary infection. (1 = Yes, -3 pts). |
neuromuscular_blockade |
Numeric (0 or 1). Use of neuromuscular blockade agents before ECMO. (1 = Yes, +1 pt). |
nitric_oxide_use |
Numeric (0 or 1). Use of Nitric Oxide before ECMO. (1 = Yes, -1 pt). |
bicarbonate_use |
Numeric (0 or 1). Use of Bicarbonate infusion before ECMO. (1 = Yes, -2 pts). |
cardiac_arrest |
Numeric (0 or 1). Pre-ECMO cardiac arrest. (1 = Yes, -2 pts). |
paco2_mmhg |
Numeric. Partial pressure of arterial carbon dioxide in mmHg. (>= 75 mmHg: -2 pts). |
pip_cmh2o |
Numeric. Peak Inspiratory Pressure in cmH2O. (>= 42 cmH2O: -2 pts). |
Value
A list containing:
RESP_Score |
The calculated total score (Range -22 to 15). |
Risk_Class |
Risk classification (Class I to V). |
Est_Hospital_Survival |
Estimated in-hospital survival percentage. |
References
Schmidt M, Bailey M, Sheldrake J, et al. Predicting survival for severe ARDS patients on extracorporeal membrane oxygenation: the RESP score. Am J Respir Crit Care Med. 2014;189(11):1374-1382. doi:10.1164/rccm.201311-2023OC
Examples
# Example 1: Good Prognosis (Class I)
# 30yo (0), Asthma (+11), MV 10h (+3), NMB (+1)
# Score = 15
resp_ecmo_score(30, 0, 10, "asthma", 0, 0, 1, 0, 0, 0, 40, 30)
# Example 2: Poor Prognosis (Class IV)
# 65yo (-3), Bacterial PNA (+3), MV 8 days (0), Immuno (-2), CNS Dysfx (-7)
# Score = -9
resp_ecmo_score(65, 1, 200, "bacterial_pneumonia", 1, 0, 0, 0, 0, 0, 40, 30)
Respiratory Score (Asthma) - Liu et al.
Description
Calculates the Liu Respiratory Score to assess the severity of acute asthma exacerbations in children. The score is based on three clinical parameters: Respiratory Rate (age-adjusted), Wheezing, and Retractions/Accessory Muscle Use.
Usage
respiratory_score_asthma_liu(age_years, respiratory_rate, wheezing_score,
retractions_score)
Arguments
age_years |
Numeric. Patient age in years. Used to stratify respiratory rate scoring (<2y, 2-5y, >5y). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. Scoring: <2y: <40(0), 40-59(1), 60-69(2), >=70(3). 2-5y: <30(0), 30-39(1), 40-49(2), >=50(3). >5y: <20(0), 20-24(1), 25-29(2), >=30(3). |
wheezing_score |
Numeric (0-3). 0: None. 1: End-expiratory only. 2: Throughout expiration. 3: Inspiration and expiration. |
retractions_score |
Numeric (0-3). Accessory muscle use/Retractions. 0: None. 1: 1 site (e.g., subcostal). 2: 2 sites (e.g., subcostal and intercostal). 3: 3 sites (e.g., subcostal, intercostal, substernal) or nasal flaring. |
Value
A list containing:
Respiratory_Score |
The calculated total score (Range 0-9). |
Severity_Classification |
Interpretation (Mild <= 3, Moderate 4-7, Severe >= 8). |
References
Liu LL, Gallaher MM, Davis RL, et al. Use of a respiratory clinical score to predict the outcome of acute asthma in children. Pediatr Emerg Care. 2004;20(4):243-247. doi:10.1097/01.pec.0000121243.13322.42
Examples
# Example 1: Moderate Exacerbation (3yo)
# RR 35 (1 pt), Wheeze entire exp (2 pts), 1 site retraction (1 pt)
# Score = 4
respiratory_score_asthma_liu(3, 35, 2, 1)
# Example 2: Severe Exacerbation (7yo)
# RR 32 (3 pts), Wheeze Insp/Exp (3 pts), 2 sites (2 pts)
# Score = 8
respiratory_score_asthma_liu(7, 32, 3, 2)
Refractory Epilepsy Screening Tool for Lennox-Gastaut Syndrome (REST-LGS)
Description
Applies the REST-LGS screening logic to identify patients with refractory epilepsy who may have undiagnosed Lennox-Gastaut Syndrome (LGS). The tool assesses four key domains: Age of onset, Drug resistance, Cognitive impairment, and Specific seizure types associated with LGS.
Usage
rest_lgs_screen(onset_lt_9y, drug_resistant, cognitive_impairment,
tonic_seizures, atonic_seizures, atypical_absence)
Arguments
onset_lt_9y |
Numeric (0 or 1). Did the patient's seizures start before age 9? (1 = Yes). |
drug_resistant |
Numeric (0 or 1). Is the epilepsy drug-resistant (failed >= 2 anti-seizure medications)? (1 = Yes). |
cognitive_impairment |
Numeric (0 or 1). Does the patient have cognitive impairment or developmental delay? (1 = Yes). |
tonic_seizures |
Numeric (0 or 1). History or presence of tonic seizures (stiffening). (1 = Yes). |
atonic_seizures |
Numeric (0 or 1). History or presence of atonic seizures (drop attacks/head drops). (1 = Yes). |
atypical_absence |
Numeric (0 or 1). History or presence of atypical absence seizures (staring spells). (1 = Yes). |
Value
A list containing:
Screening_Result |
"Positive Screen" or "Negative Screen". |
Recommendation |
Clinical guidance based on the screening result. |
References
Piña-Garza JE, Montouris GD, Spearman BK, et al. The Refractory Epilepsy Screening Tool for Lennox-Gastaut Syndrome (REST-LGS). Epilepsy Behav. 2019;90:148-153. doi:10.1016/j.yebeh.2018.11.016
Examples
# Example 1: Positive Screen
# Onset <9, Resistant, Cognitive issues, Tonic seizures
rest_lgs_screen(1, 1, 1, 1, 0, 0)
# Example 2: Negative Screen
# Onset >9 years old
rest_lgs_screen(0, 1, 1, 1, 0, 0)
Absolute Reticulocyte Count & Reticulocyte Index
Description
Calculates hematological indices to assess bone marrow response to anemia. 1. **Absolute Reticulocyte Count (ARC):** Actual number of reticulocytes per volume of blood. 2. **Reticulocyte Index (RI):** Corrects the reticulocyte count for the degree of anemia (Hematocrit). 3. **Reticulocyte Production Index (RPI):** Further corrects the RI for the premature release of reticulocytes from the marrow (Maturation Shift), providing the most accurate assessment of effective RBC production.
Usage
reticulocyte_indices(retic_percent, rbc_count_million,
hematocrit_percent, normal_hct = 45)
Arguments
retic_percent |
Numeric. The percentage of red blood cells that are reticulocytes (e.g., 2.5). |
rbc_count_million |
Numeric. The Red Blood Cell count in millions/uL (or 10^12/L). (e.g., 3.5). |
hematocrit_percent |
Numeric. The patient's Hematocrit percentage (e.g., 30). |
normal_hct |
Numeric. The expected normal Hematocrit. Defaults to 45%. |
Value
A list containing:
Absolute_Reticulocyte_Count |
Total reticulocytes (cells/uL). |
Reticulocyte_Index |
Corrected count based on hematocrit reduction. |
Reticulocyte_Production_Index |
The RI corrected for maturation time (shift correction). |
Marrow_Response |
Interpretation of the RPI (Adequate > 3, Inadequate < 2). |
References
Hillman RS, Finch CA. Red Cell Manual. 7th ed. Philadelphia, Pa: FA Davis Co; 1996.
Examples
# Example 1: Hemolytic Anemia (Appropriate Response)
# Retic 15%, RBC 2.5 M/uL, Hct 25%
# ARC = 375,000; RI = 8.33; RPI = 8.33 / 2.0 = 4.16 (Adequate)
reticulocyte_indices(15, 2.5, 25)
# Example 2: Hypoproliferative Anemia (Inadequate Response)
# Retic 2%, RBC 3.0 M/uL, Hct 28%
# ARC = 60,000; RI = 1.24; RPI = 1.24 / 2.0 = 0.62 (Inadequate)
reticulocyte_indices(2, 3.0, 28)
REVEAL Registry Risk Score 2.0 for Pulmonary Arterial Hypertension (PAH)
Description
Calculates the REVEAL 2.0 Risk Score to predict 12-month survival in patients with Pulmonary Arterial Hypertension (PAH). This updated version refines the original REVEAL score by incorporating renal function, all-cause hospitalizations, and modifying cut-points for other variables.
Usage
reveal_pah_risk_score(who_group1_subgroup, age_years, male_sex,
renal_insufficiency, nyha_class, systolic_bp, heart_rate,
hospitalizations_6mo, six_min_walk_distance,
bnp_level = NULL, nt_probnp_level = NULL,
pericardial_effusion, dlco_predicted, mrap_gt_20, pvr_lt_5)
Arguments
who_group1_subgroup |
String. Subgroup of PAH. "portopulmonary": +3 pts. "familial" or "heritable": +2 pts. "ctd" (Connective Tissue Disease): +1 pt. "other" (Idiopathic, Drug/Toxin, CHD, HIV, etc.): 0 pts. |
age_years |
Numeric. Patient age in years. |
male_sex |
Numeric (0 or 1). Is the patient male? (1 = Yes). (Male > 60 years adds +2 pts). |
renal_insufficiency |
Numeric (0 or 1). eGFR < 60 mL/min/1.73m^2 or clinical renal insufficiency. (1 = Yes, +1 pt). |
nyha_class |
Numeric (1-4). NYHA Functional Class. Class I: -1 pt. Class II: 0 pts. Class III: +1 pt. Class IV: +2 pts. |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. (< 110 mmHg adds +1 pt). |
heart_rate |
Numeric. Heart rate in bpm. (> 96 bpm adds +1 pt). |
hospitalizations_6mo |
Numeric (0 or 1). Any all-cause hospitalizations within the last 6 months? (1 = Yes, +1 pt). |
six_min_walk_distance |
Numeric. 6-Minute Walk Distance in meters. >= 440m: -2 pts. 320-<440m: -1 pt. 165-<320m: 0 pts. < 165m: +1 pt. |
bnp_level |
Numeric (Optional). BNP level in pg/mL. <50: -2 pts. 50-<200: 0 pts. 200-<800: +1 pt. >=800: +2 pts. |
nt_probnp_level |
Numeric (Optional). NT-proBNP level in pg/mL. (If provided, takes precedence or used if BNP missing). <300: -2 pts. 300-<1100: 0 pts. >=1100: +2 pts. |
pericardial_effusion |
Numeric (0 or 1). Presence of pericardial effusion on echocardiogram. (1 = Yes, +1 pt). |
dlco_predicted |
Numeric. DLCO percent predicted. (< 40% adds +1 pt). |
mrap_gt_20 |
Numeric (0 or 1). Mean Right Atrial Pressure > 20 mmHg on RHC within 1 year. (1 = Yes, +1 pt). |
pvr_lt_5 |
Numeric (0 or 1). Pulmonary Vascular Resistance < 5 Wood units on RHC. (1 = Yes, -1 pt). |
Value
A list containing:
REVEAL_2_0_Score |
The calculated risk score (Range approx -6 to +23). |
Risk_Group |
Classification (Low <=6, Intermediate 7-8, High >=9). |
Mortality_Risk_12_Month |
Estimated 12-month mortality risk. |
References
Benza RL, Gomberg-Maitland M, Elliott CG, et al. Predicting Survival in Patients With Pulmonary Arterial Hypertension: The REVEAL Risk Score Calculator 2.0 and Comparison With ESC/ERS-Based Risk Assessment Strategies. Chest. 2019;156(2):323-337. doi:10.1016/j.chest.2019.02.004
Examples
# Example 1: Low Risk
# Idiopathic, 40yo Female, Normal Renal, NYHA II, SBP 120, HR 80,
#No Hosp, 6MWD 450, NT-proBNP 200, No Effusion, DLCO 60, mRAP 10, PVR 4
# Score = 0 + 0 + 0 + 0 + 0 + 0 + 0 - 2 - 2 + 0 + 0 + 0 - 1 = -5
reveal_pah_risk_score("other", 40, 0, 0, 2, 120, 80, 0, 450, NULL, 200, 0, 60, 0, 1)
# Example 2: High Risk
# CTD (+1), 70yo Male (+2), Renal (+1), NYHA III (+1), SBP 100 (+1),
#HR 100 (+1), Hosp (+1), 6MWD 150 (+1), BNP 900 (+2), Effusion (+1),
#DLCO 30 (+1), mRAP 22 (+1), PVR 8 (0)
# Score = 1 + 2 + 1 + 1 + 1 + 1 + 1 + 1 + 2 + 1 + 1 + 1 + 0 = 14
reveal_pah_risk_score("ctd", 70, 1, 1, 3, 100, 100, 1, 150, 900, NULL, 1, 30, 1, 0)
Revised Cardiac Risk Index (RCRI) for Pre-Operative Risk
Description
Calculates the Revised Cardiac Risk Index (Lee Index) to estimate the risk of major cardiac complications (myocardial infarction, pulmonary edema, ventricular fibrillation, cardiac arrest, complete heart block) after noncardiac surgery.
Usage
revised_cardiac_risk_index(high_risk_surgery, ischemic_heart_disease,
congestive_heart_failure, cerebrovascular_disease,
insulin_treatment, preop_creatinine_gt_2)
Arguments
high_risk_surgery |
Numeric (0 or 1). Intraperitoneal, intrathoracic, or suprainguinal vascular surgery. (1 = Yes). |
ischemic_heart_disease |
Numeric (0 or 1). History of MI, positive exercise test, current chest pain due to ischemia, nitrate use, or pathological Q waves. (1 = Yes). |
congestive_heart_failure |
Numeric (0 or 1). History of CHF, pulmonary edema, or paroxysmal nocturnal dyspnea. (1 = Yes). |
cerebrovascular_disease |
Numeric (0 or 1). Prior TIA or stroke. (1 = Yes). |
insulin_treatment |
Numeric (0 or 1). Pre-operative treatment with insulin. (1 = Yes). |
preop_creatinine_gt_2 |
Numeric (0 or 1). Pre-operative serum creatinine > 2.0 mg/dL (> 176.8 micromol/L). (1 = Yes). |
Value
A list containing:
RCRI_Score |
The calculated score (Range 0-6). |
Risk_Class |
The Lee Risk Class (I, II, III, or IV). |
Est_Major_Cardiac_Event_Risk |
Estimated probability of a major cardiac event based on the original validation cohort. |
References
Lee TH, Marcantonio ER, Mangione CM, et al. Derivation and prospective validation of a simple index for prediction of cardiac risk of major noncardiac surgery. Circulation. 1999;100(10):1043-1049. doi:10.1161/01.cir.100.10.1043
Examples
# Example 1: Low Risk
# No risk factors
# Score = 0
revised_cardiac_risk_index(0, 0, 0, 0, 0, 0)
# Example 2: High Risk
# Vascular surgery (+1), Insulin (+1), History of MI (+1)
# Score = 3
revised_cardiac_risk_index(1, 1, 0, 0, 1, 0)
Revised International Staging System (R-ISS) for Multiple Myeloma
Description
Calculates the Revised International Staging System (R-ISS) for multiple myeloma. This system combines the original ISS (serum beta-2 microglobulin and albumin) with chromosomal abnormalities (CA) detected by iFISH and serum lactate dehydrogenase (LDH) levels to improve prognostic stratification.
Usage
revised_iss_multiple_myeloma(beta2_microglobulin, albumin, ldh_elevated,
high_risk_chromosomal_abnormalities)
Arguments
beta2_microglobulin |
Numeric. Serum Beta-2 Microglobulin level in mg/L. |
albumin |
Numeric. Serum Albumin level in g/dL. |
ldh_elevated |
Numeric (0 or 1). Is serum LDH greater than the upper limit of normal? (1 = Yes). |
high_risk_chromosomal_abnormalities |
Numeric (0 or 1). Presence of high-risk chromosomal abnormalities by iFISH (del(17p), t(4;14), or t(14;16)). (1 = Yes). |
Details
Staging Criteria:
-
R-ISS I: ISS Stage I (B2M < 3.5 and Alb >= 3.5) AND No High Risk CA AND Normal LDH.
-
R-ISS III: ISS Stage III (B2M >= 5.5) AND (High Risk CA OR High LDH).
-
R-ISS II: Not R-ISS I or III.
Value
A list containing:
R_ISS_Stage |
The calculated R-ISS Stage (I, II, or III). |
ISS_Stage_Calculated |
The underlying standard ISS stage. |
Median_Overall_Survival |
Estimated median overall survival. |
Five_Year_Survival |
Estimated 5-year overall survival rate. |
References
Palumbo A, Avet-Loiseau H, Oliva S, et al. Revised International Staging System for Multiple Myeloma: A Report From International Myeloma Working Group. J Clin Oncol. 2015;33(26):2863-2869. doi:10.1200/JCO.2015.61.2267
Examples
# Example 1: R-ISS Stage I
# B2M 2.0, Alb 4.0 (ISS I), Normal LDH, No High Risk CA
revised_iss_multiple_myeloma(2.0, 4.0, 0, 0)
# Example 2: R-ISS Stage III
# B2M 6.0 (ISS III), High LDH
revised_iss_multiple_myeloma(6.0, 3.0, 1, 0)
# Example 3: R-ISS Stage II
# B2M 2.0, Alb 4.0 (ISS I), but High LDH (Disqualifies R-ISS I)
revised_iss_multiple_myeloma(2.0, 4.0, 1, 0)
Revised Opioid Risk Tool (ORT-OUD)
Description
Calculates the Revised Opioid Risk Tool (ORT-OUD) score. This tool uses the standard ORT scoring algorithm to predict the risk of Opioid Use Disorder (OUD) in patients prescribed opioids for chronic pain. It stratifies risk based on personal and family history of substance abuse, age, history of preadolescent sexual abuse, and psychological disease, with gender-specific weighting.
Usage
revised_opioid_risk_tool(sex, age, family_hx_alcohol, family_hx_illegal, family_hx_rx,
personal_hx_alcohol, personal_hx_illegal, personal_hx_rx,
history_sexual_abuse, psych_disease_adhd_ocd_bipolar_schizo,
psych_disease_depression)
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age |
Numeric. Patient age in years. (Age 16-45 adds 1 point). |
family_hx_alcohol |
Numeric (0 or 1). Family history of alcohol abuse. (Female: +1, Male: +3). |
family_hx_illegal |
Numeric (0 or 1). Family history of illegal drug abuse. (Female: +2, Male: +3). |
family_hx_rx |
Numeric (0 or 1). Family history of prescription drug abuse. (Female: +4, Male: +4). |
personal_hx_alcohol |
Numeric (0 or 1). Personal history of alcohol abuse. (Female: +3, Male: +3). |
personal_hx_illegal |
Numeric (0 or 1). Personal history of illegal drug abuse. (Female: +4, Male: +4). |
personal_hx_rx |
Numeric (0 or 1). Personal history of prescription drug abuse. (Female: +5, Male: +5). |
history_sexual_abuse |
Numeric (0 or 1). History of preadolescent sexual abuse. (Female: +3, Male: 0). |
psych_disease_adhd_ocd_bipolar_schizo |
Numeric (0 or 1). Psychological disease (ADD, OCD, Bipolar, Schizophrenia). (Female: +2, Male: +2). |
psych_disease_depression |
Numeric (0 or 1). Psychological disease (Depression). (Female: +1, Male: +1). |
Value
A list containing:
ORT_OUD_Score |
The calculated total score (Range 0-26). |
Risk_Category |
Classification (Low 0-3, Moderate 4-7, High >= 8). |
References
Cheatle MD, Compton PA, Dhingra L, et al. Development of the Revised Opioid Risk Tool to Predict Opioid Use Disorder in Patients with Chronic Nonmalignant Pain. J Pain. 2019;20(7):842-851. doi:10.1016/j.jpain.2019.01.011
Examples
# Example 1: High Risk Male
# Fam Hx Alcohol (+3), Pers Hx Illegal (+4), Age 30 (+1)
# Score = 8
revised_opioid_risk_tool("male", 30, 1, 0, 0, 0, 1, 0, 0, 0, 0)
# Example 2: Moderate Risk Female
# Fam Hx Alcohol (+1), Hx Sexual Abuse (+3)
# Score = 4
revised_opioid_risk_tool("female", 50, 1, 0, 0, 0, 0, 0, 1, 0, 0)
Revised Original Score for Autoimmune Hepatitis (1999)
Description
Calculates the 1999 Revised Original Score (International Autoimmune Hepatitis Group) for the diagnosis of Autoimmune Hepatitis (AIH). This comprehensive scoring system evaluates biochemical ratios, autoantibodies, viral markers, histology, and history to classify patients as having Probable or Definite AIH.
Usage
revised_original_aih_score(sex, alp_ast_ratio, globulin_igg_ratio,
autoantibody_titer, ama_positive,
viral_markers_positive, drug_history_positive,
alcohol_intake_low, histology_interface,
histology_plasma_cells, histology_rosettes,
histology_biliary, other_immune_disease,
hla_dr3_dr4, treatment_response = "none")
Arguments
sex |
String. "female" (+2 pts) or "male" (0 pts). |
alp_ast_ratio |
Numeric. Ratio of Alkaline Phosphatase to AST (relative to ULN). (<1.5: +2, 1.5-3.0: 0, >3.0: -2). |
globulin_igg_ratio |
Numeric. Ratio of Serum Globulins (or IgG) to the Upper Limit of Normal. (>2.0: +3, 1.5-2.0: +2, 1.0-1.5: +1, <1.0: 0). |
autoantibody_titer |
String. Titer of ANA, SMA, or Anti-LKM1. Options: "gt_1_80" (>1:80, +3), "1_80" (1:80, +2), "1_40" (1:40, +1), "lt_1_40" (<1:40, 0). |
ama_positive |
Numeric (0 or 1). Antimitochondrial Antibody positive? (1 = Yes, -4 pts). |
viral_markers_positive |
Numeric (0 or 1). Positive markers for active Hepatitis A, B, or C? (1 = Yes, -3 pts; 0 = No, +3 pts). |
drug_history_positive |
Numeric (0 or 1). History of hepatotoxic drug use? (1 = Yes, -4 pts; 0 = No, +1 pt). |
alcohol_intake_low |
Numeric (0 or 1). Average alcohol intake < 25 g/day? (1 = Yes, +2 pts; 0 = No, -2 pts). |
histology_interface |
Numeric (0 or 1). Interface hepatitis (piecemeal necrosis)? (1 = Yes, +3 pts). |
histology_plasma_cells |
Numeric (0 or 1). Predominantly lymphoplasmacytic infiltrate? (1 = Yes, +1 pt). |
histology_rosettes |
Numeric (0 or 1). Liver cell rosettes? (1 = Yes, +1 pt). |
histology_biliary |
Numeric (0 or 1). Biliary changes? (1 = Yes, -3 pts). (Note: If histology "None of above" is present, that is -5 pts, usually captured by entering 0 for all specific positives). |
other_immune_disease |
Numeric (0 or 1). Presence of other autoimmune diseases? (1 = Yes, +2 pts). |
hla_dr3_dr4 |
Numeric (0 or 1). HLA DR3 or DR4 present? (1 = Yes, +1 pt). |
treatment_response |
String. Response to therapy (optional for pre-treatment score). "none" (0), "complete" (remission, +2), "relapse" (relapse after cessation, +3). |
Value
A list containing:
AIH_Score |
The calculated total score. |
Diagnosis |
Diagnostic classification (Definite >15, Probable 10-15, Unlikely <10). |
References
Alvarez F, Berg PA, Bianchi FB, et al. International Autoimmune Hepatitis Group Report: review of criteria for diagnosis of autoimmune hepatitis. J Hepatol. 1999;31(5):929-938. doi:10.1016/s0168-8278(99)80297-9
Examples
# Example 1: Definite AIH
# Female (+2), Low ALP ratio (+2), High IgG (+3), ANA 1:160 (+3), No viral/drugs/alcohol (+3+1+2)
# Interface (+3), Plasma (+1)
# Score = 2+2+3+3+3+1+2+3+1 = 20
revised_original_aih_score("female", 1.0, 2.5, "gt_1_80", 0, 0, 0, 1, 1, 1, 0, 0, 0, 0)
# Example 2: AIH Unlikely
# Male (0), Viral Pos (-3), Alcohol High (-2), Histology Biliary (-3)
# Score = -8 + baseline factors
revised_original_aih_score("male", 2.0, 1.0, "lt_1_40", 0, 1, 0, 0, 0, 0, 0, 1, 0, 0)
Revised Natural History Model for Primary Sclerosing Cholangitis (PSC)
Description
Calculates the Revised Natural History Model (Mayo PSC Risk Score) for patients with Primary Sclerosing Cholangitis. This prognostic score estimates survival (time to death or liver transplantation) based on age, bilirubin, albumin, AST, and history of variceal bleeding. It updates the original Mayo model by removing the need for liver biopsy (histologic stage).
Usage
revised_psc_risk_score(age, bilirubin_mg_dl, albumin_g_dl, ast_u_l,
history_variceal_bleeding)
Arguments
age |
Numeric. Patient age in years. |
bilirubin_mg_dl |
Numeric. Total serum bilirubin in mg/dL. |
albumin_g_dl |
Numeric. Serum albumin in g/dL. |
ast_u_l |
Numeric. Aspartate aminotransferase (AST) level in U/L. |
history_variceal_bleeding |
Numeric (0 or 1). History of variceal bleeding. (1 = Yes, 0 = No). |
Details
The score is calculated using the formula:
R = 0.03 \times Age + 0.54 \times \ln(Bilirubin) + 0.54 \times \ln(AST) + 1.24 \times VaricealBleeding - 0.84 \times Albumin
Higher scores indicate a worse prognosis (higher risk of death or need for transplant).
Value
A list containing:
PSC_Risk_Score |
The calculated risk score (R). |
References
Kim WR, Therneau TM, Wiesner RH, et al. A revised natural history model for primary sclerosing cholangitis. Mayo Clin Proc. 2000;75(7):688-694. doi:10.4065/75.7.688
Examples
# Example 1: High Risk
# 50yo, Bili 5.0, Alb 2.5, AST 150, Bleeding Hx
revised_psc_risk_score(50, 5.0, 2.5, 150, 1)
# Example 2: Low Risk
# 30yo, Bili 0.8, Alb 4.0, AST 30, No Bleeding
revised_psc_risk_score(30, 0.8, 4.0, 30, 0)
Revised Schwartz Equation for Pediatric GFR (2009)
Description
Calculates the estimated Glomerular Filtration Rate (eGFR) for children and adolescents (ages 1-17) with chronic kidney disease using the "Bedside" Revised Schwartz Equation (2009). This updated formula uses a standardized constant (k=0.413) for methods where serum creatinine is measured via enzymatic assay (IDMS-traceable).
Usage
revised_schwartz_gfr(height, serum_creatinine,
height_units = "cm", creatinine_units = "mg/dL")
Arguments
height |
Numeric. Patient height. |
serum_creatinine |
Numeric. Serum creatinine level. |
height_units |
String. Units for height input. Options: "cm" (default) or "in". |
creatinine_units |
String. Units for creatinine input. Options: "mg/dL" (default) or "umol/L" (or "micromol/L"). |
Details
The formula is:
eGFR = \frac{0.413 \times Height (cm)}{Serum Creatinine (mg/dL)}
Value
A list containing:
Estimated_GFR |
The calculated eGFR in mL/min/1.73 m^2. |
Interpretation |
CKD staging category based on the eGFR result. |
References
Schwartz GJ, Munoz A, Schneider MF, et al. New equations to estimate GFR in children with CKD. J Am Soc Nephrol. 2009;20(3):629-637. doi:10.1681/ASN.2008030287
Examples
# Example 1: Normal Function
# Height 120 cm, Creatinine 0.5 mg/dL
# eGFR = (0.413 * 120) / 0.5 = 99.1
revised_schwartz_gfr(120, 0.5)
# Example 2: Renal Impairment
# Height 48 inches (122 cm), Creatinine 100 umol/L (1.13 mg/dL)
# eGFR = (0.413 * 121.92) / 1.13 = 44.6
revised_schwartz_gfr(48, 100, "in", "umol/L")
Revised Tokuhashi Score for Metastatic Spine Tumor Prognosis
Description
Calculates the Revised Tokuhashi Score (2005) to estimate the prognosis and guide treatment for patients with metastatic spinal tumors. The score evaluates six parameters: general condition (KPS), number of extraspinal bone metastases, number of vertebral metastases, metastases to major internal organs, primary site of cancer, and spinal cord palsy severity.
Usage
revised_tokuhashi_score(kps, number_extraspinal_bone_mets, number_vertebral_mets,
major_organ_metastases, primary_site_group, palsy_frankel)
Arguments
kps |
Numeric. Karnofsky Performance Status score (0-100). <50: 0 pts. 50-70: 1 pt. 80-100: 2 pts. |
number_extraspinal_bone_mets |
Numeric. Number of extraspinal bone metastases. >=3: 0 pts. 1-2: 1 pt. 0: 2 pts. |
number_vertebral_mets |
Numeric. Number of metastases in the vertebral body. >=3: 0 pts. 2: 1 pt. 1: 2 pts. |
major_organ_metastases |
String. Status of metastases to major internal organs (lungs, liver, kidneys, brain). "unremovable": 0 pts. "removable": 1 pt. "none": 2 pts. |
primary_site_group |
String. The primary cancer site. "lung", "osteosarcoma", "stomach", "bladder", "esophagus", "pancreas": 0 pts. "liver", "gallbladder", "unidentified": 1 pt. "others": 2 pts. "kidney", "uterus": 3 pts. "rectum": 4 pts. "thyroid", "breast", "prostate", "carcinoid": 5 pts. |
palsy_frankel |
String. Severity of spinal cord palsy based on Frankel Classification. "complete" (Frankel A, B): 0 pts. "incomplete" (Frankel C, D): 1 pt. "none" (Frankel E): 2 pts. |
Value
A list containing:
Tokuhashi_Score |
The calculated total score (Range 0-15). |
Prognosis |
Estimated life expectancy (<6 months, >=6 months, >=1 year). |
Treatment_Recommendation |
Suggested surgical or conservative approach based on prognosis. |
References
Tokuhashi Y, Matsuzaki H, Oda H, Oshima M, Ryu J. A revised scoring system for preoperative evaluation of metastatic spine tumor prognosis. Spine (Phila Pa 1976). 2005;30(19):2186-2191. doi:10.1097/01.brs.0000180401.06919.a5
Examples
# Example 1: Poor Prognosis
# KPS 40 (0), 3 Extraspinal (0), 3 Vertebral (0),
#Unremovable Organ Mets (0), Lung CA (0), Complete Palsy (0)
# Score = 0
revised_tokuhashi_score(40, 3, 3, "unremovable", "lung", "complete")
# Example 2: Good Prognosis
# KPS 90 (2), 0 Extraspinal (2), 1 Vertebral (2), No Organ Mets (2), Breast CA (5), No Palsy (2)
# Score = 15
revised_tokuhashi_score(90, 0, 1, "none", "breast", "none")
Revised Trauma Score (RTS)
Description
Calculates the Revised Trauma Score (RTS), a physiological scoring system used to assess trauma severity. It provides two outputs: the Triage RTS (range 0-12, integer sum) for rapid field assessment, and the Standard RTS (range 0-7.8408, weighted sum) for outcome prediction and quality assurance.
Usage
revised_trauma_score(gcs, systolic_bp, respiratory_rate)
Arguments
gcs |
Numeric. Glasgow Coma Scale score (3-15). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. |
Details
The coded values (0-4) for each parameter are assigned as follows:
-
GCS: 13-15 (4), 9-12 (3), 6-8 (2), 4-5 (1), 3 (0).
-
SBP: >89 (4), 76-89 (3), 50-75 (2), 1-49 (1), 0 (0).
-
RR: 10-29 (4), >29 (3), 6-9 (2), 1-5 (1), 0 (0).
The Standard RTS uses the formula: RTS = 0.9368(GCS_c) + 0.7326(SBP_c) + 0.2908(RR_c).
Value
A list containing:
Triage_RTS |
Simple sum of coded values (0-12). Lower scores indicate higher severity. |
Standard_RTS |
Weighted sum (0-7.8408). Higher scores indicate better probability of survival. |
Coded_Values |
The intermediate 0-4 scores assigned to each input. |
References
Champion HR, Sacco WJ, Copes WS, et al. A revision of the Trauma Score. J Trauma. 1989;29(5):623-629.
Examples
# Example 1: Stable Patient
# GCS 15 (4), SBP 120 (4), RR 16 (4)
# Triage RTS = 12, Standard RTS = 7.8408
revised_trauma_score(15, 120, 16)
# Example 2: Severe Trauma
# GCS 7 (2), SBP 80 (3), RR 35 (3)
# Standard RTS = 0.9368(2) + 0.7326(3) + 0.2908(3) = 1.8736 + 2.1978 + 0.8724 = 4.9438
revised_trauma_score(7, 80, 35)
Reynolds Risk Score for Cardiovascular Risk in Women
Description
Calculates the 10-year cardiovascular disease risk (myocardial infarction, stroke, coronary revascularization, or cardiovascular death) for women. This score improves upon the Framingham Risk Score by incorporating high-sensitivity C-reactive protein (hs-CRP) and family history.
Usage
reynolds_risk_score_women(age_years, systolic_bp_mmhg, total_cholesterol_mg_dl,
hdl_cholesterol_mg_dl, hs_crp_mg_l, hba1c_percent,
current_smoker, family_history_premature_mi)
Arguments
age_years |
Numeric. Patient age in years (designed for ages 45 and older). |
systolic_bp_mmhg |
Numeric. Systolic blood pressure in mmHg. |
total_cholesterol_mg_dl |
Numeric. Total cholesterol level in mg/dL. |
hdl_cholesterol_mg_dl |
Numeric. HDL cholesterol level in mg/dL. |
hs_crp_mg_l |
Numeric. High-sensitivity C-reactive protein level in mg/L. |
hba1c_percent |
Numeric. Hemoglobin A1c percentage. (If non-diabetic and unknown, a standard reference value like 5.0 may be used, though clinical measurement is preferred). |
current_smoker |
Numeric (0 or 1). Current cigarette smoker. (1 = Yes). |
family_history_premature_mi |
Numeric (0 or 1). Parental history of myocardial infarction before age 60. (1 = Yes). |
Value
A list containing:
Reynolds_Risk_Score |
The estimated 10-year risk percentage. |
Risk_Category |
Classification (Low <5%, Intermediate 5-10%, High 10-20%, Very High >=20%). |
References
Ridker PM, Buring JE, Rifai N, Cook NR. Development and validation of improved algorithms for the assessment of global cardiovascular risk in women: the Reynolds Risk Score. JAMA. 2007;297(6):611-619. doi:10.1001/jama.297.6.611
Examples
# Example 1: Low Risk
# 50yo, SBP 120, TC 180, HDL 50, CRP 0.5, A1c 5.0, Non-smoker, No Fam Hx
reynolds_risk_score_women(50, 120, 180, 50, 0.5, 5.0, 0, 0)
# Example 2: High Risk
# 65yo, SBP 150, TC 240, HDL 40, CRP 5.0, A1c 6.5, Smoker, Fam Hx
reynolds_risk_score_women(65, 150, 240, 40, 5.0, 6.5, 1, 1)
R Factor for Liver Injury
Description
Using alanine aminotransferase and alkaline phosphatase calculate an index that can distinguish between hepatocellulal, cholestatic, or a combination of both in patients presenting with acute liver injury. Recommended for use in risk stratification and diagnosis by the American College of Gastroenterology.
Usage
rfactor(alt, alp)
Arguments
alt |
Numeric value of alanine aminotransferase (U/L). |
alp |
Numeric value of alkaline phosphatase (U/L). |
Value
A numeric value/vector with predicted cause of liver injury.
References
Bénichou C. Criteria of drug-induced liver disorders. Report of an international consensus meeting. J Hepatol. 1990;11(2):272-6. Chalasani NP, Hayashi PH, Bonkovsky HL, et al. ACG Clinical Guideline: the diagnosis and management of idiosyncratic drug-induced liver injury. Am J Gastroenterol. 2014;109(7):950-66.
Examples
# The function is defined as
rfactor(40, 50)
R Factor for Liver Injury Interpreted
Description
Using alanine aminotransferase and alkaline phosphatase calculate an index that can distinguish between hepatocellulal, cholestatic, or a combination of both in patients presenting with acute liver injury. Index value is then interpreted in the ocntext of hepatocellular or cholestatic disease. Recommended for use in risk stratification and diagnosis by the American College of Gastroenterology.
Usage
rfactor_interpret(alt, alp)
Arguments
alt |
Numeric value of alanine aminotransferase (U/L). |
alp |
Numeric value of alkaline phosphatase (U/L). |
Value
A numeric value/vector with predicted R factor score.
References
Bénichou C. Criteria of drug-induced liver disorders. Report of an international consensus meeting. J Hepatol. 1990;11(2):272-6. Chalasani NP, Hayashi PH, Bonkovsky HL, et al. ACG Clinical Guideline: the diagnosis and management of idiosyncratic drug-induced liver injury. Am J Gastroenterol. 2014;109(7):950-66.
Examples
# The function is defined as
rfactor_interpret(40, 50)
Rh Immune Globulin Dosage for Fetomaternal Hemorrhage
Description
Calculates the required dosage of Rho(D) immune globulin (RhoGAM) in vials following a significant Fetomaternal Hemorrhage (FMH) based on the Kleihauer-Betke Stain (KBS) result. This dosage is critical for preventing RhD alloimmunization in RhD-negative mothers.
Usage
rhd_immune_globulin_dosage(kbs_fetal_cells_per_5000, maternal_blood_volume_ml = 5000)
Arguments
kbs_fetal_cells_per_5000 |
Numeric. The number of fetal cells counted per 5000 maternal cells on the Kleihauer-Betke Stain. |
maternal_blood_volume_ml |
Numeric. Estimated maternal blood volume in milliliters. Defaults to 5000 mL (5 Liters) for standard adult calculations. |
Details
The calculation determines the volume of fetal blood in the maternal circulation, which is then used to calculate the required number of RhoGAM vials. One standard dose of RhoGAM covers 30 mL of fetal whole blood. The result is rounded up, and one extra vial is added as a safety margin.
Value
A list containing:
Fetal_Blood_Volume_mL |
The estimated volume of fetal whole blood in the maternal circulation. |
RhoGAM_Vials_Calculated |
The total number of RhoGAM vials recommended (calculated dose rounded up + 1 extra vial). |
References
ACOG Practice Bulletin No. 192: Prevention of Rh D Alloimmunization. Obstet Gynecol. 2018;131(3):e57-e73. doi:10.1097/AOG.0000000000002521
Examples
# Example 1: Large Hemorrhage
# 100 fetal cells per 5000 maternal cells (Ratio 1:50)
# Fetal volume = (100/5000) * 5000 = 100 mL
# Vials needed = ceil(100/30) + 1 = 4 + 1 = 5 vials
rhd_immune_globulin_dosage(100)
# Example 2: Small Hemorrhage
# 15 fetal cells per 5000 maternal cells
rhd_immune_globulin_dosage(15)
Rotterdam Hip Fracture Mortality Prediction 30 Days (RHMP-30)
Description
Calculates the RHMP-30 Score to predict 30-day mortality in patients undergoing surgery for hip fracture. The score stratifies risk based on age, sex, ASA classification, and pre-injury housing status.
Usage
rhmp_30_score(age, sex, asa_score, housing_status)
Arguments
age |
Numeric. Patient age in years. <60: 0 pts. 60-69: 1 pt. 70-79: 2 pts. 80-89: 4 pts. >=90: 6 pts. |
sex |
String. "Male" or "Female". (Male adds 2 pts). |
asa_score |
Numeric. ASA Physical Status Classification (1-5). 1-2: 0 pts. 3: 2 pts. 4: 4 pts. 5: 6 pts. |
housing_status |
String. Pre-injury living situation. "independent" (Home/Community): 0 pts. "institution" (Nursing Home/Assisted Living): 2 pts. |
Value
A list containing:
RHMP_30_Score |
The calculated risk score (Range 0-16). |
Est_30_Day_Mortality |
Estimated 30-day mortality risk category. |
References
Nijmeijer WS, et al. Prediction of early mortality following hip fracture surgery in frail elderly: The Rotterdam Score. Injury. 2016;47(10):2138-2143. doi:10.1016/j.injury.2016.07.022
Examples
# Example 1: High Risk
# 85yo (+4), Male (+2), ASA 3 (+2), Institution (+2)
# Score = 10
rhmp_30_score(85, "male", 3, "institution")
# Example 2: Low Risk
# 65yo (+1), Female (0), ASA 2 (0), Independent (0)
# Score = 1
rhmp_30_score(65, "female", 2, "independent")
RibScore for Predicting Pulmonary Complications
Description
Calculates the RibScore to predict the risk of pulmonary complications (pneumonia, respiratory failure, or need for tracheostomy) in patients with rib fractures. The score is derived from six clinical variables: age, number of fractures, presence of bilateral fractures, flail chest, chronic lung disease, and pre-injury anticoagulant use.
Usage
ribscore_trauma(age, fracture_count, bilateral_fractures, flail_chest,
chronic_lung_disease, anticoagulant_use)
Arguments
age |
Numeric. Patient age in years. <45: 0 pts. 45-64: 1 pt. >=65: 2 pts. |
fracture_count |
Numeric. Total number of rib fractures. <3: 0 pts. 3-5: 1 pt. >=6: 2 pts. |
bilateral_fractures |
Numeric (0 or 1). Presence of bilateral rib fractures. (1 = Yes, +2 pts). |
flail_chest |
Numeric (0 or 1). Presence of flail chest (segmental fractures of >=3 adjacent ribs). (1 = Yes, +2 pts). |
chronic_lung_disease |
Numeric (0 or 1). History of chronic lung disease (e.g., COPD, asthma). (1 = Yes, +2 pts). |
anticoagulant_use |
Numeric (0 or 1). Pre-injury use of anticoagulants (e.g., warfarin, DOACs, antiplatelets). (1 = Yes, +2 pts). |
Value
A list containing:
RibScore |
The calculated total score (Range 0-12). |
Pulmonary_Complication_Risk |
Estimated percentage risk of pneumonia, respiratory failure, or tracheostomy. |
References
Chapman BC, Herbert B, Rodil M, et al. RibScore: A novel decision aid to predict pulmonary complications in patients with rib fractures. J Trauma Acute Care Surg. 2016;80(1):95-101. doi:10.1097/TA.0000000000000893
Examples
# Example 1: High Risk
# 70yo (+2), 6 fractures (+2), Bilateral (+2), Flail (+2)
# Score = 8
ribscore_trauma(70, 6, 1, 1, 0, 0)
# Example 2: Low Risk
# 30yo (0), 2 fractures (0), No other factors
# Score = 0
ribscore_trauma(30, 2, 0, 0, 0, 0)
Richmond Agitation-Sedation Scale (RASS)
Description
Calculates the RASS score, a validated tool to assess the level of sedation and agitation in hospitalized patients. It uses a logic-based approach starting with observation of behavior, followed by response to voice, and finally response to physical stimulation.
Usage
richmond_agitation_sedation_scale(observed_behavior,
voice_stimulation = "not_applicable",
physical_stimulation = "not_applicable")
Arguments
observed_behavior |
String. The patient's spontaneous behavior. Options: "combative" (+4) "very_agitated" (+3) "agitated" (+2) "restless" (+1) "alert_and_calm" (0) "not_alert" (Proceed to voice stimulation) |
voice_stimulation |
String. Response to verbal stimulation (e.g., calling name, asking to open eyes). Required if |
physical_stimulation |
String. Response to physical stimulation (e.g., shoulder shake, sternal rub). Required if no response to voice. Options: "movement_or_eye_opening" (-4) "no_response" (-5) "not_applicable" (Default) |
Value
A list containing:
RASS_Score |
The calculated score (integer from -5 to +4). |
Term |
The clinical term associated with the score (e.g., "Light Sedation"). |
Description |
Detailed description of the patient's state. |
References
Sessler CN, Gosnell MS, Grap MJ, et al. The Richmond Agitation-Sedation Scale: validity and reliability in adult intensive care unit patients. Am J Respir Crit Care Med. 2002;166(10):1338-1344. doi:10.1164/rccm.2107138
Examples
# Example 1: Agitated Patient
# Patient is fighting the ventilator
richmond_agitation_sedation_scale("agitated")
# Example 2: Light Sedation
# Patient is not alert, makes eye contact for < 10 seconds to voice
richmond_agitation_sedation_scale("not_alert", "eye_contact_lt_10s")
# Example 3: Unarousable
# Patient not alert, no response to voice, no response to physical stim
richmond_agitation_sedation_scale("not_alert", "no_response", "no_response")
RIETE Score for Risk of Hemorrhage in Pulmonary Embolism Treatment
Description
Calculates the RIETE Score to predict the risk of major hemorrhage within the first 3 months of anticoagulant treatment for Venous Thromboembolism (VTE). The score helps stratify patients into Low, Intermediate, and High risk categories based on six clinical variables.
Usage
riete_hemorrhage_risk(age_gt_75, recent_bleeding, cancer, creatinine_gt_1_2,
hemoglobin_lt_13_or_12, pe_diagnosis)
Arguments
age_gt_75 |
Numeric (0 or 1). Patient age > 75 years. (1 = Yes, +1 point). |
recent_bleeding |
Numeric (0 or 1). Recent major bleeding (within 30 days prior to VTE diagnosis). (1 = Yes, +2 points). |
cancer |
Numeric (0 or 1). Active cancer. (1 = Yes, +1 point). |
creatinine_gt_1_2 |
Numeric (0 or 1). Abnormal creatinine levels (> 1.2 mg/dL). (1 = Yes, +1.5 points). |
hemoglobin_lt_13_or_12 |
Numeric (0 or 1). Anemia (Hemoglobin < 13 g/dL for men, < 12 g/dL for women). (1 = Yes, +1.5 points). |
pe_diagnosis |
Numeric (0 or 1). Clinically overt Pulmonary Embolism (PE). (1 = Yes, +1 point). |
Value
A list containing:
RIETE_Score |
The calculated risk score (Range 0-8). |
Risk_Category |
Classification (Low: 0, Intermediate: 1-4, High: >4). |
Major_Bleeding_Risk_3_Months |
Estimated risk of major bleeding. |
Fatal_Bleeding_Risk_3_Months |
Estimated risk of fatal bleeding. |
References
Nieto JA, Solano R, Trapero-Gimeno I, et al. Fatal bleeding in patients receiving anticoagulant therapy for venous thromboembolism: findings from the RIETE registry. J Thromb Haemost. 2010;8(6):1216-1222. doi:10.1111/j.1538-7836.2010.03852.x
Examples
# Example 1: High Risk
# Recent Bleed (+2), Anemia (+1.5), Creatinine >1.2 (+1.5)
# Score = 5
riete_hemorrhage_risk(0, 1, 0, 1, 1, 0)
# Example 2: Low Risk
# 60yo, No risk factors
# Score = 0
riete_hemorrhage_risk(0, 0, 0, 0, 0, 0)
RIFLE Criteria for Acute Kidney Injury (AKI)
Description
Calculates the RIFLE classification (Risk, Injury, Failure, Loss, End-stage) for Acute Kidney Injury. The classification is based on the worst of either serum creatinine/GFR criteria or urine output criteria. 'Loss' and 'End-stage' are outcome categories determined by the duration of kidney failure, which are not calculated by this function (typically >4 weeks and >3 months, respectively).
Usage
rifle_criteria_aki(baseline_creatinine, current_creatinine, gfr_decrease_percent,
urine_output_ml_kg_hr, urine_output_duration_hours,
anuria_duration_hours)
Arguments
baseline_creatinine |
Numeric. Baseline serum creatinine level (mg/dL). |
current_creatinine |
Numeric. Current serum creatinine level (mg/dL). |
gfr_decrease_percent |
Numeric. Percentage decrease in GFR (if known). Set to 0 if unknown. (25% = Risk, 50% = Injury, 75% = Failure). |
urine_output_ml_kg_hr |
Numeric. Urine output rate in mL/kg/hr. |
urine_output_duration_hours |
Numeric. Duration of decreased urine output in hours. |
anuria_duration_hours |
Numeric. Duration of anuria in hours. |
Value
A list containing:
RIFLE_Class |
The final determined RIFLE class (Risk, Injury, Failure, or No AKI). |
GFR_Criteria_Class |
Classification based on creatinine/GFR criteria alone. |
Urine_Output_Criteria_Class |
Classification based on urine output criteria alone. |
References
Bellomo R, Ronco C, Kellum JA, et al. Acute renal failure - definition, outcome measures, animal models, fluid therapy and information technology needs: the Second International Consensus Conference of the Acute Dialysis Quality Initiative (ADQI) Group. Crit Care. 2004;8(4):R204-212. doi:10.1186/cc2872
Examples
# Example 1: Injury Class (High Creatinine)
# Baseline Cr 1.0, Current Cr 2.5 (>2x increase)
rifle_criteria_aki(1.0, 2.5, 0, 1.0, 0, 0)
# Example 2: Failure Class (Low Urine Output)
# Cr normal, UO < 0.3 ml/kg/h for 24 hours
rifle_criteria_aki(1.0, 1.1, 0, 0.2, 24, 0)
Recurrent Instability of the Patella (RIP) Score
Description
Calculates the RIP Score to predict the risk of recurrent patellar dislocation. The score utilizes four clinical and radiographic factors: age, skeletal maturity (open physes), trochlear dysplasia, and history of contralateral dislocation.
Usage
rip_patella_score(age, skeletal_immature, trochlear_dysplasia,
contralateral_dislocation)
Arguments
age |
Numeric. Patient age in years. (< 25 years adds 2 points). |
skeletal_immature |
Numeric (0 or 1). Are physes open (skeletally immature)? (1 = Yes, +1 point). |
trochlear_dysplasia |
Numeric (0 or 1). Presence of trochlear dysplasia on lateral radiograph. (1 = Yes, +1 point). |
contralateral_dislocation |
Numeric (0 or 1). History of contralateral patellar dislocation. (1 = Yes, +1 point). |
Value
A list containing:
RIP_Score |
The calculated total score (Range 0-5). |
Risk_Category |
Classification (Low 0-1, Intermediate 2-3, High 4-5). |
Recurrence_Risk |
Estimated percentage risk of recurrence. |
References
Cheung JP, Fung B, Ip WY, Chow SP. Review on recurrent dislocation of the patella. Orthopedics. 2008;31(1):76-80. Hevesi M, Heckmann N, Brown GA, et al. The Recurrent Instability of the Patella (RIP) Score: A Statistically Based Predictive Tool for Recurrent Patellar Instability. Am J Sports Med. 2019;47(4):922-928. doi:10.1177/0363546518825255
Examples
# Example 1: High Risk
# 16yo (+2), Open Physes (+1), Dysplasia (+1), No contralateral history
# Score = 4
rip_patella_score(16, 1, 1, 0)
# Example 2: Low Risk
# 30yo (0), Closed Physes (0), Dysplasia (1), No contralateral history
# Score = 1
rip_patella_score(30, 0, 1, 0)
RIPASA Score for Acute Appendicitis
Description
Calculates the RIPASA score, a diagnostic scoring system developed to improve the sensitivity and specificity of diagnosing acute appendicitis, particularly in Asian and Middle Eastern populations compared to the Alvarado score. It utilizes 15 clinical and demographic parameters.
Usage
ripasa_appendicitis_score(sex, age, rif_pain, pain_migration, anorexia,
nausea_vomiting, symptom_duration_lt_48h, rif_tenderness,
guarding, rebound_tenderness, rovsing_sign, fever,
elevated_wbc, negative_urinalysis, foreign_national)
Arguments
sex |
String. Patient sex ("Male" or "Female"). (Male +1, Female +0.5). |
age |
Numeric. Patient age in years. (<40y +1, >=40y +0.5). |
rif_pain |
Numeric (0 or 1). Pain in the Right Iliac Fossa. (1 = Yes, +0.5). |
pain_migration |
Numeric (0 or 1). Migration of pain to the RIF. (1 = Yes, +0.5). |
anorexia |
Numeric (0 or 1). Anorexia. (1 = Yes, +1). |
nausea_vomiting |
Numeric (0 or 1). Nausea and/or vomiting. (1 = Yes, +1). |
symptom_duration_lt_48h |
Numeric (0 or 1). Duration of symptoms less than 48 hours. (1 = Yes, +1; 0 (>48h) = +0.5). |
rif_tenderness |
Numeric (0 or 1). Tenderness in the RIF. (1 = Yes, +1). |
guarding |
Numeric (0 or 1). Guarding in the RIF. (1 = Yes, +2). |
rebound_tenderness |
Numeric (0 or 1). Rebound tenderness. (1 = Yes, +1). |
rovsing_sign |
Numeric (0 or 1). Positive Rovsing's sign. (1 = Yes, +2). |
fever |
Numeric (0 or 1). Fever (typically > 37.5C or 99.5F). (1 = Yes, +1). |
elevated_wbc |
Numeric (0 or 1). Elevated White Blood Cell count. (1 = Yes, +1). |
negative_urinalysis |
Numeric (0 or 1). Negative urinalysis (absence of blood/nitrites/leukocytes). (1 = Yes, +1). |
foreign_national |
Numeric (0 or 1). Is the patient a foreign national (relative to the derivation setting, e.g., foreign NRIC)? (1 = Yes, +1). |
Value
A list containing:
RIPASA_Score |
The calculated total score. |
Appendicitis_Probability |
Estimated likelihood category (Unlikely, Low, High, Definite). |
Recommendation |
Suggested management plan. |
References
Chong CF, Adi MI, Thien A, et al. Development of the RIPASA score: a new appendicitis scoring system for the diagnosis of acute appendicitis. Singapore Med J. 2010;51(3):220-225.
Examples
# Example 1: High Probability
# Male (+1), 30y (+1), RIF Pain (+0.5), Migration (+0.5), Guarding (+2), Rebound (+1), High WBC (+1)
# Score = 7.0
ripasa_appendicitis_score("male", 30, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0)
# Example 2: Definite Appendicitis
# Male, 25y, All signs positive except foreign national
# Score > 12
ripasa_appendicitis_score("male", 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)
Risk of Malignancy Index (RMI) for Ovarian Cancer
Description
Calculates the Risk of Malignancy Index (RMI I) to stratify the risk of ovarian cancer in women with adnexal masses. The score combines serum CA-125 levels, ultrasound findings, and menopausal status. An RMI score greater than 200 suggests a higher risk of malignancy and typically warrants referral to a gynecological oncologist.
Usage
risk_malignancy_index(ca125_level, menopausal_status, multilocular_cyst,
solid_areas, bilateral_lesions, ascites,
intraabdominal_metastases)
Arguments
ca125_level |
Numeric. Serum CA-125 level in U/mL. |
menopausal_status |
String. "pre" (1 point) or "post" (3 points). Post-menopausal is defined as >1 year of amenorrhea or age >50 in hysterectomized women. |
multilocular_cyst |
Numeric (0 or 1). Presence of a multilocular cystic lesion on ultrasound. (1 = Yes). |
solid_areas |
Numeric (0 or 1). Presence of solid areas within the mass on ultrasound. (1 = Yes). |
bilateral_lesions |
Numeric (0 or 1). Presence of bilateral lesions on ultrasound. (1 = Yes). |
ascites |
Numeric (0 or 1). Presence of ascites on ultrasound. (1 = Yes). |
intraabdominal_metastases |
Numeric (0 or 1). Presence of intra-abdominal metastases on ultrasound. (1 = Yes). |
Details
The formula for RMI I is:
RMI = U \times M \times CA125
Where:
-
U (Ultrasound Score): 0 if no features, 1 if 1 feature, 3 if 2-5 features.
-
M (Menopausal Status): 1 if Pre-menopausal, 3 if Post-menopausal.
-
CA125: Absolute value of serum CA-125.
Value
A list containing:
RMI_Score |
The calculated Risk of Malignancy Index. |
Risk_Category |
Interpretation based on the threshold of 200 (High vs. Low). |
Recommendation |
Referral guidance. |
References
Jacobs I, Oram D, Fairbanks J, et al. A risk of malignancy index incorporating CA 125, ultrasound and menopausal status for the accurate preoperative diagnosis of ovarian cancer. Br J Obstet Gynaecol. 1990;97(10):922-929. doi:10.1111/j.1471-0528.1990.tb02448.x
Examples
# Example 1: High Risk
# CA125 100, Post-menopausal (3), 2 US features (Solid, Ascites -> U=3)
# RMI = 3 * 3 * 100 = 900
risk_malignancy_index(100, "post", 0, 1, 0, 1, 0)
# Example 2: Low Risk
# CA125 25, Pre-menopausal (1), 1 US feature (Multilocular -> U=1)
# RMI = 1 * 1 * 25 = 25
risk_malignancy_index(25, "pre", 1, 0, 0, 0, 0)
RISK-E Score for Cardiac Surgery in Active Infective Endocarditis
Description
Calculates the RISK-E score to predict in-hospital mortality for patients with active infective endocarditis undergoing cardiac surgery. The score is derived from preoperative variables including age, shock (cardiogenic/septic), immunosuppression, renal function, pathogen (S. aureus), and valve characteristics.
Usage
riske_score_cardiac_surgery(age, shock_cardiogenic, shock_septic,
immunosuppression, kidney_injury,
staphylococcus_aureus, acute_renal_failure_preop,
prostheses_involved_count, aortic_valve_involved)
Arguments
age |
Numeric. Patient age in years. |
shock_cardiogenic |
Numeric (0 or 1). Presence of cardiogenic shock. (1 = Yes, +6 pts). |
shock_septic |
Numeric (0 or 1). Presence of septic shock. (1 = Yes, +11 pts). |
immunosuppression |
Numeric (0 or 1). Immunosuppressed status. (1 = Yes, +4 pts). |
kidney_injury |
Numeric (0 or 1). History of kidney injury or chronic kidney disease. (1 = Yes, +5 pts). |
staphylococcus_aureus |
Numeric (0 or 1). Causative organism is Staphylococcus aureus. (1 = Yes, +6 pts). |
acute_renal_failure_preop |
Numeric (0 or 1). Presence of acute renal failure preoperatively. (1 = Yes, +5 pts). |
prostheses_involved_count |
Numeric. Number of prosthetic valves involved/infected. (>=1 adds 6 pts). |
aortic_valve_involved |
Numeric (0 or 1). Involvement of the aortic valve. (1 = Yes, +4 pts). |
Value
A list containing:
RISKE_Score |
The calculated total score (Range 0-~60). |
Risk_Category |
Classification (Low, Intermediate, High, Very High). |
Est_InHospital_Mortality |
Estimated in-hospital mortality percentage range. |
References
Olmos C, Vilacosta I, Habib G, et al. Risk score for cardiac surgery in active infective endocarditis. Heart. 2017;103(18):1435-1442. doi:10.1136/heartjnl-2016-311093
Examples
# Example 1: High Risk
# 65yo (+9), Septic Shock (+11), S. aureus (+6), Aortic Valve (+4)
# Score = 30
riske_score_cardiac_surgery(65, 0, 1, 0, 0, 1, 0, 0, 1)
# Example 2: Low Risk
# 35yo (0), No shock, No organ failure, Mitral Valve (0)
# Score = 0
riske_score_cardiac_surgery(35, 0, 0, 0, 0, 0, 0, 0, 0)
Rochester Criteria for Febrile Infants
Description
Calculates the Rochester Criteria to identify febrile infants (typically < 60 days old) at low risk for serious bacterial infection (SBI). Meeting all criteria suggests a low risk, potentially allowing for outpatient management without lumbar puncture (though clinical practice varies).
Usage
rochester_criteria_febrile_infant(well_appearing, no_skeletal_soft_tissue_infection,
term_infant, no_unexplained_hyperbilirubinemia,
no_previous_antimicrobials, no_prior_hospitalization,
no_chronic_illness, wbc_count, band_count_percent,
urinalysis_wbc_hpf, stool_wbc_hpf = NULL,
diarrhea_present = 0)
Arguments
well_appearing |
Numeric (0 or 1). Infant generally well-appearing? (1 = Yes). |
no_skeletal_soft_tissue_infection |
Numeric (0 or 1). No evidence of ear, soft tissue, or skeletal infection? (1 = Yes). |
term_infant |
Numeric (0 or 1). Born at term (>= 37 weeks)? (1 = Yes). |
no_unexplained_hyperbilirubinemia |
Numeric (0 or 1). No unexplained hyperbilirubinemia? (1 = Yes). |
no_previous_antimicrobials |
Numeric (0 or 1). No previous antimicrobial therapy (perinatal or postnatal)? (1 = Yes). |
no_prior_hospitalization |
Numeric (0 or 1). No prior hospitalizations (excluding birth)? (1 = Yes). |
no_chronic_illness |
Numeric (0 or 1). No chronic or underlying illness? (1 = Yes). |
wbc_count |
Numeric. Peripheral WBC count (cells/mm^3). (Low risk: 5,000 - 15,000). |
band_count_percent |
Numeric. Band neutrophils percentage. (Low risk: Absolute band count < 1,500/mm^3). |
urinalysis_wbc_hpf |
Numeric. Urinalysis WBC per high-power field. (Low risk: < 10). |
stool_wbc_hpf |
Numeric (Optional). Stool WBC per high-power field. Required if diarrhea is present. (Low risk: < 5). |
diarrhea_present |
Numeric (0 or 1). Is diarrhea present? (1 = Yes). |
Value
A list containing:
Risk_Classification |
"Low Risk" or "High Risk". |
Inputs |
Breakdown of whether History, Exam, and Lab criteria were met. |
References
Jaskiewicz JA, McCarthy CA, Richardson AC, et al. Febrile infants at low risk for serious bacterial infection–an appraisal of the Rochester criteria and implications for management. Febrile Infant Collaborative Study Group. Pediatrics. 1994;94(3):390-396.
Examples
# Example 1: Low Risk
# Well appearing, Term, No history issues, WBC 10k, Bands 5%, UA 2 WBC
rochester_criteria_febrile_infant(1, 1, 1, 1, 1, 1, 1, 10000, 5, 2, NULL, 0)
# Example 2: High Risk
# Preterm (0), otherwise normal
rochester_criteria_febrile_infant(1, 1, 0, 1, 1, 1, 1, 10000, 5, 2, NULL, 0)
Rockall Score for Upper GI Bleeding (Complete)
Description
Calculates the complete Rockall Score to predict the risk of mortality and rebleeding in patients with upper gastrointestinal bleeding. This version requires endoscopic findings (diagnosis and stigmata of recent hemorrhage).
Usage
rockall_score_complete(age, systolic_bp, heart_rate, comorbidity_category,
diagnosis_category, major_stigmata_present)
Arguments
age |
Numeric. Patient age in years. |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
heart_rate |
Numeric. Heart rate in beats per minute. |
comorbidity_category |
String. Major comorbidities. "none": No major comorbidity (0 pts). "cardiac_other": Heart failure, ischemic heart disease, or other major morbidity (2 pts). "renal_liver_metastatic": Renal failure, liver failure, or metastatic cancer (3 pts). |
diagnosis_category |
String. Diagnosis determined by endoscopy. "mallory_weiss_none": Mallory-Weiss tear or no lesion identified (0 pts). "all_other": All other diagnoses (e.g., ulcers, erosions, esophagitis) (1 pt). "malignancy": Malignancy of the upper GI tract (2 pts). |
major_stigmata_present |
Numeric (0 or 1). Presence of major stigmata of recent hemorrhage (blood in upper GI tract, adherent clot, visible or spurting vessel). (1 = Yes, +2 pts). Note: Clean base or dark spot only is 0 pts. |
Value
A list containing:
Rockall_Score |
The calculated score (Range 0-11). |
Mortality_Risk |
Estimated mortality risk percentage. |
Rebleed_Risk |
Estimated rebleeding risk percentage. |
References
Rockall TA, Logan RF, Devlin HB, Northfield TC. Risk assessment after acute upper gastrointestinal haemorrhage. Gut. 1996;38(3):316-321. doi:10.1136/gut.38.3.316
Examples
# Example 1: High Risk
# 70yo (+1), SBP 95 (+2), Renal Failure (+3), Ulcer (+1), Visible Vessel (+2)
# Score = 9
rockall_score_complete(70, 95, 100, "renal_liver_metastatic", "all_other", 1)
# Example 2: Low Risk
# 45yo (0), SBP 120 (0), No Comorbs (0), Mallory-Weiss (0), No Stigmata (0)
# Score = 0
rockall_score_complete(45, 120, 70, "none", "mallory_weiss_none", 0)
Rome II Diagnostic Criteria for Irritable Bowel Syndrome (IBS)
Description
Evaluates the **Rome II criteria** for diagnosing Irritable Bowel Syndrome (IBS) in adults. Diagnosis requires recurrent abdominal pain or discomfort for at least 12 weeks (which need not be consecutive) in the preceding 12 months, along with two or more specific features related to pain relief, and changes in stool frequency or consistency. This classification system has been largely superseded by Rome III and Rome IV.
Usage
rome_ii_ibs_criteria(abdominal_pain_discomfort_12mo, pain_relief_by_defecation,
pain_onset_associated_with_frequency_change,
pain_onset_associated_with_consistency_change,
no_structural_disease_excluded)
Arguments
abdominal_pain_discomfort_12mo |
Numeric (0 or 1). Recurrent abdominal pain or discomfort for at least 12 weeks in the past 12 months. (1 = Yes). |
pain_relief_by_defecation |
Numeric (0 or 1). Pain relieved by defecation. (1 = Yes). |
pain_onset_associated_with_frequency_change |
Numeric (0 or 1). Pain onset associated with a change in frequency of stool. (1 = Yes). |
pain_onset_associated_with_consistency_change |
Numeric (0 or 1). Pain onset associated with a change in stool consistency/appearance [Image of bristol stool scale chart] . (1 = Yes). |
no_structural_disease_excluded |
Numeric (0 or 1). After appropriate evaluation, are there **no** structural or organic diseases to explain the symptoms? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Irritable Bowel Syndrome (IBS)" or "Criteria Not Met". |
IBS_Features_Count |
The number of positive associated features (max 3, requires >= 2 for diagnosis). |
References
Thompson WG, Longstreth GF, Drossman DA, et al. Functional bowel disorders and functional abdominal pain. Gut. 1999;45 Suppl 2:II43-7.
Examples
# Example 1: Diagnosis Met
# Pain 12mo (1), Pain relief by defecation (1), Change frequency (1), Change consistency (0)
# Result: Meets Criteria (2 features met)
rome_ii_ibs_criteria(1, 1, 1, 0, 1)
# Example 2: Not Met (Insufficient features)
# Pain 12mo (1), Only Pain relief by defecation (1)
# Result: Criteria Not Met (Only 1 feature met)
rome_ii_ibs_criteria(1, 1, 0, 0, 1)
Rome III Diagnostic Criteria for Irritable Bowel Syndrome (IBS)
Description
Evaluates the **Rome III criteria** for diagnosing Irritable Bowel Syndrome (IBS) in adults. Diagnosis requires recurrent abdominal pain or discomfort on average at least **3 days per month** in the last 3 months, associated with two or more specific features related to defecation, stool frequency, or consistency. Symptoms must have onset at least 6 months prior to diagnosis.
Usage
rome_iii_ibs_criteria(pain_discomfort_frequency, pain_relief_by_defecation,
pain_onset_associated_with_frequency_change,
pain_onset_associated_with_consistency_change,
symptoms_onset_ge_6_months_ago, symptoms_active_last_3_months,
no_structural_disease_excluded)
Arguments
pain_discomfort_frequency |
Numeric. Frequency of abdominal pain or discomfort in **days per month** (must be >= 3 days/month). |
pain_relief_by_defecation |
Numeric (0 or 1). Pain relieved by defecation. (1 = Yes). |
pain_onset_associated_with_frequency_change |
Numeric (0 or 1). Pain onset associated with a change in frequency of stool. (1 = Yes). |
pain_onset_associated_with_consistency_change |
Numeric (0 or 1). Pain onset associated with a change in stool consistency/appearance [Image of bristol stool scale chart] . (1 = Yes). |
symptoms_onset_ge_6_months_ago |
Numeric (0 or 1). Did symptoms onset at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have criteria been fulfilled for the last **3 months**? (1 = Yes). |
no_structural_disease_excluded |
Numeric (0 or 1). Have structural or organic diseases been excluded? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Irritable Bowel Syndrome (IBS)" or "Criteria Not Met". |
IBS_Features_Count |
The number of positive associated features (requires >= 2 for diagnosis). |
References
Longstreth GF, Thompson WG, Chey WD, et al. Functional bowel disorders. Gastroenterology. 2006;130(5):1480-1491. doi:10.1053/j.gastro.2005.11.060
Examples
# Example 1: Diagnosis Met
# Pain 5 days/mo, Pain relief (1), Change frequency (1), No change consistency (0), Chronic met
rome_iii_ibs_criteria(5, 1, 1, 0, 1, 1, 1)
# Example 2: Not Met (Insufficient frequency)
# Pain 1 day/mo, Pain relief (1), Change frequency (1), Change consistency (1)
rome_iii_ibs_criteria(1, 1, 1, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Belching Disorders
Description
Evaluates the **Rome IV criteria** for diagnosing **Belching Disorders** (Supragastric Belching or Gastric Belching). Diagnosis is based on the predominant type of belch and requires frequent, recurrent symptoms, chronicity, and the exclusion of aerophagia.
Usage
rome_iv_belching_disorders(symptoms_ge_3_day_week, aerophagia_excluded,
supragastric_belch_type, gastric_belch_type,
symptom_onset_ge_6_months, symptoms_active_last_3_months)
Arguments
symptoms_ge_3_day_week |
Numeric (0 or 1). Recurrent belching occurring on at least **3 days per week**. (1 = Yes). |
aerophagia_excluded |
Numeric (0 or 1). **Aerophagia** (excessive air swallowing) **is excluded**. (1 = Yes). |
supragastric_belch_type |
Numeric (0 or 1). Predominant belch is supragastric (air is drawn into the esophagus and immediately expelled). (1 = Yes). |
gastric_belch_type |
Numeric (0 or 1). Predominant belch is gastric (belch originates from the stomach). (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have criteria been fulfilled for the last **3 months**? (1 = Yes). |
Value
A list containing:
Diagnosis |
The resulting classification ("Supragastric Belching", "Gastric Belching", or "Criteria Not Met"). |
References
Yazdanpanah A, Sifrim D. Functional Disorders: Esophageal Disorders. Gastroenterology. 2016;150:1367-1379. doi:10.1053/j.gastro.2016.02.002
Examples
# Example 1: Supragastric Belching
# Freq met, Aerophagia excluded, Supragastric present, Chronic duration met
rome_iv_belching_disorders(1, 1, 1, 0, 1, 1)
# Example 2: Gastric Belching
# Freq met, Aerophagia excluded, Gastric present
rome_iv_belching_disorders(1, 1, 0, 1, 1, 1)
Rome IV Diagnostic Criteria for Functional Biliary Pain
Description
Evaluates the **Rome IV criteria** for diagnosing **Functional Biliary Pain**. This diagnosis is a prerequisite for diagnosing Functional Gallbladder Disorder or Functional Sphincter of Oddi Disorder, requiring recurrent pain episodes that meet specific criteria for location, severity, and course.
Usage
rome_iv_biliary_pain_criteria(location, severity, course, other_pain_excluded,
normal_imaging, not_explained_by_other_condition,
symptom_onset_ge_6_months, symptoms_active_last_3_months)
Arguments
location |
String. Pain location: "epigastrium", "ruq" (right upper quadrant), or "both". |
severity |
Numeric (0 or 1). Is the pain severe enough to interrupt daily activities or lead to an emergency room visit? (1 = Yes). |
course |
String. Pain course: "bouts" (rapidly builds up/subsides) or "steady" (pain plateau). |
other_pain_excluded |
Numeric (0 or 1). Does the pain radiate to the back or shoulder, which suggests other causes? (1 = Yes). Note: This input refers to the exclusion of non-biliary patterns. |
normal_imaging |
Numeric (0 or 1). Has imaging (e.g., ultrasound) excluded gallstones and other structural pathology? (1 = Yes). |
not_explained_by_other_condition |
Numeric (0 or 1). Are the symptoms NOT fully explained by other conditions (e.g., PUD, GERD)? (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last **3 months**? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Functional Biliary Pain" or "Criteria Not Met". |
References
Corazziari E, Shaffer EA, Hogan WJ, et al. Functional Disorders of the Gallbladder and Sphincter of Oddi. Gastroenterology. 2016;150:1443-1455. doi:10.1053/j.gastro.2016.02.044
Examples
# Example 1: Diagnosis Met
# Pain RUQ, Severe, Bouts, Other pain excluded, Normal imaging, Chronic duration
rome_iv_biliary_pain_criteria("ruq", 1, "bouts", 1, 1, 1, 1, 1)
# Example 2: Not Met (Not Chronic)
# All criteria met, but symptoms active for 1 month only
rome_iv_biliary_pain_criteria("epigastrium", 1, "steady", 1, 1, 1, 0, 1)
Rome IV Diagnostic Criteria for Cannabinoid Hyperemesis Syndrome (CHS)
Description
Evaluates the **Rome IV criteria** for diagnosing **Cannabinoid Hyperemesis Syndrome (CHS)**. Diagnosis requires cyclical episodes of vomiting and nausea, chronic cannabis use, relief from symptoms with hot baths/showers, and exclusion of other causes.
Usage
rome_iv_cannabinoid_hyperemesis_syndrome(recurrent_severe_vomiting,
cannabis_use_ge_6mo,
symptoms_relieved_by_hot_bath,
symptom_onset_after_cannabis,
other_conditions_excluded,
symptom_onset_ge_6mo,
symptoms_active_last_3mo)
Arguments
recurrent_severe_vomiting |
Numeric (0 or 1). Presence of recurrent, severe nausea and vomiting. (1 = Yes). |
cannabis_use_ge_6mo |
Numeric (0 or 1). History of prolonged and frequent cannabis use (e.g., typically daily/weekly for >= 6 months). (1 = Yes). |
symptoms_relieved_by_hot_bath |
Numeric (0 or 1). Symptoms are relieved by hot baths or showers. (1 = Yes). |
symptom_onset_after_cannabis |
Numeric (0 or 1). Did symptoms start after cannabis use began? (1 = Yes). |
other_conditions_excluded |
Numeric (0 or 1). Have other causes of cyclical vomiting been excluded? (1 = Yes). |
symptom_onset_ge_6mo |
Numeric (0 or 1). Did symptom onset occur at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3mo |
Numeric (0 or 1). Have criteria been fulfilled for the last **3 months**? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Cannabinoid Hyperemesis Syndrome (CHS)" or "Criteria Not Met". |
References
Stanghellini V, Chan FK, Hasler WL, et al. Gastroduodenal Disorders. Gastroenterology. 2016;150:1380-1392. doi:10.1053/j.gastro.2016.02.011
Examples
# Example 1: Diagnosis Met
# Recurrent vomiting (1), Chronic use (1), Hot bath relief (1),
#Onset after cannabis (1), Exclusions clear, Chronic duration met
rome_iv_cannabinoid_hyperemesis_syndrome(1, 1, 1, 1, 1, 1, 1)
# Example 2: Not Met (No hot bath relief)
# All criteria met except no symptom relief with hot baths (0)
rome_iv_cannabinoid_hyperemesis_syndrome(1, 1, 0, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Centrally Mediated Abdominal Pain Syndrome (CAPS)
Description
Evaluates the **Rome IV criteria** for diagnosing **Centrally Mediated Abdominal Pain Syndrome (CAPS)** (formerly Functional Abdominal Pain Syndrome, FAPS). CAPS is a functional disorder characterized by chronic, often continuous abdominal pain that has lost its association with gastrointestinal function and significantly impairs daily activities.
Usage
rome_iv_caps_criteria(chronic_abdominal_pain, loss_of_social_functioning,
pain_not_explained_by_other_fgid, pain_not_explained_by_organic,
symptom_onset_ge_6_months, symptoms_active_last_3_months)
Arguments
chronic_abdominal_pain |
Numeric (0 or 1). Presence of **chronic or continuous abdominal pain**. (1 = Yes). |
loss_of_social_functioning |
Numeric (0 or 1). Pain associated with significant **loss of daily, social, or work functioning** or recurrent medical visits. (1 = Yes). |
pain_not_explained_by_other_fgid |
Numeric (0 or 1). **Not** meeting criteria for another functional gastrointestinal disorder (FGID) that could explain the pain (e.g., IBS, functional dyspepsia). (1 = Yes). |
pain_not_explained_by_organic |
Numeric (0 or 1). **Not** better explained by an organic gastrointestinal disease. (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last **3 months**? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Centrally Mediated Abdominal Pain Syndrome (CAPS)" or "Criteria Not Met". |
References
Drossman DA, Hasler WL. The Rome IV Criteria: Innovations and Impact on Clinical Practice. J Clin Gastroenterol. 2016;50(Suppl 1):S1-S7. doi:10.1097/MCG.0000000000000624
Examples
# Example 1: Diagnosis Met
# Chronic pain (1), Social impact (1), No other FGID/Organic cause, Chronic duration met
rome_iv_caps_criteria(1, 1, 1, 1, 1, 1)
# Example 2: Not Met (Pain can be explained by IBS)
# Chronic pain (1), Social impact (1), Meets IBS criteria (0 for exclusion)
rome_iv_caps_criteria(1, 1, 0, 1, 1, 1)
Rome IV Diagnostic Criteria for Child Abdominal Migraine
Description
Evaluates the **Rome IV criteria** for diagnosing **Abdominal Migraine** in children and adolescents. Diagnosis requires recurrent, paroxysmal attacks of moderate to severe abdominal pain, specific pain characteristics, associated migraine features, and exclusion of other causes, with symptoms present for at least 3 months.
Usage
rome_iv_child_abdominal_migraine(paroxysmal_pain_duration,
median_episodes_ge_2_per_year,
pain_periumbilical_midline_poorly_localized,
pain_severity_moderate_severe, pain_fully_resolves_hours_days,
associated_symptoms_count, not_explained_by_other_condition,
symptom_onset_ge_6_months, symptoms_active_last_3_months)
Arguments
paroxysmal_pain_duration |
Numeric. Duration of paroxysmal pain in hours. **Must be 2-72 hours** (input 1 if met, 0 if not). |
median_episodes_ge_2_per_year |
Numeric (0 or 1). **Median episode frequency of at least 2 per year**. (1 = Yes). |
pain_periumbilical_midline_poorly_localized |
Numeric (0 or 1). Pain **periumbilical, midline, or poorly localized**. (1 = Yes). |
pain_severity_moderate_severe |
Numeric (0 or 1). Pain **severity is moderate to severe**. (1 = Yes). |
pain_fully_resolves_hours_days |
Numeric (0 or 1). Pain **fully resolves** between episodes (hours to days). (1 = Yes). |
associated_symptoms_count |
Numeric. **Count** of associated symptoms (anorexia, nausea, vomiting, pallor). **Must be >= 2**. |
not_explained_by_other_condition |
Numeric (0 or 1). **Not** better explained by another medical condition. (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have criteria been fulfilled for the last **3 months**? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Abdominal Migraine" or "Criteria Not Met". |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Diagnosis Met
# Duration 4h (1), Freq met (1), Pain location/severity/resolution met (1,1,1),
#2+ associated symptoms (2), No other cause, Chronic duration met
rome_iv_child_abdominal_migraine(4, 1, 1, 1, 1, 2, 1, 1, 1)
# Example 2: Not Met (Insufficient associated symptoms)
# Duration 4h (1), Freq met (1), Pain characteristics met (1,1,1), 1 associated symptom (1)
rome_iv_child_abdominal_migraine(4, 1, 1, 1, 1, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Child Aerophagia
Description
Evaluates the **Rome IV criteria** for diagnosing **Aerophagia** (excessive air swallowing) in children and adolescents. Diagnosis requires three key symptoms—excessive air swallowing, abdominal distention, and repetitive belching/flatus—at least 3 days per week, with symptom onset at least 6 months prior and active for the last 3 months, after excluding organic causes.
Usage
rome_iv_child_aerophagia(symptom_frequency_ge_3_day_week,
excessive_air_swallowing, abdominal_distention,
repetitive_belching_flatus, not_explained_by_other_condition,
symptom_onset_ge_6_months, symptoms_active_last_3_months)
Arguments
symptom_frequency_ge_3_day_week |
Numeric (0 or 1). Does the symptom pattern occur at least 3 days per week? (1 = Yes). |
excessive_air_swallowing |
Numeric (0 or 1). Does the patient swallow excessive air? (1 = Yes). |
abdominal_distention |
Numeric (0 or 1). Is there abdominal distention due to intraluminal air? (1 = Yes). |
repetitive_belching_flatus |
Numeric (0 or 1). Is there repetitive belching and/or increased flatus? (1 = Yes). |
not_explained_by_other_condition |
Numeric (0 or 1). Are symptoms **NOT** fully explained by another medical condition (e.g., celiac disease, upper GI disease)? (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last **3 months**? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Aerophagia" or "Criteria Not Met". |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Diagnosis Met
# Frequency met (1), Air swallowing (1), Distention (1),
#Belching (1), No other cause (1), Chronic duration
rome_iv_child_aerophagia(1, 1, 1, 1, 1, 1, 1)
# Example 2: Not Met (Insufficient frequency)
# All criteria met except symptoms only 1 day/week (0)
rome_iv_child_aerophagia(0, 1, 1, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Infant Colic
Description
Evaluates the Rome IV criteria for diagnosing **Infant Colic**, a functional gastrointestinal disorder of early infancy. Diagnosis requires recurrent, prolonged periods of crying, fussing, or irritability without any apparent cause, typically peaking at 6 weeks and resolving by 5 months of age.
Usage
rome_iv_child_colic(crying_duration_hours, fussiness_duration_hours,
days_per_week_frequency, symptom_onset_age,
symptom_resolution_age, other_causes_excluded)
Arguments
crying_duration_hours |
Numeric. Average duration of crying in hours per day. |
fussiness_duration_hours |
Numeric. Average duration of fussiness in hours per day. **Total crying + fussing must be >= 3 hours/day.** |
days_per_week_frequency |
Numeric. Number of days per week the crying/fussing occurs. **Must be >= 3 days/week.** |
symptom_onset_age |
Numeric. Age of symptom onset in months. **Must start and resolve before 5 months of age.** |
symptom_resolution_age |
Numeric. Age of symptom resolution in months. |
other_causes_excluded |
Numeric (0 or 1). Have failure to thrive, fever, or other physical causes of crying been ruled out? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Infant Colic" or "Criteria Not Met". |
References
Zeevenhooven J, Browne PD, Huertas-Ceballos AA. Definition of infant colic: a systematic review and modified Delphi approach. Acta Paediatr. 2018;107(7):1155-1160. Rome Foundation. Functional Gastrointestinal Disorders: Children and Adolescents. Gastroenterology. 2016.
Examples
# Example 1: Diagnosis Met (Wessel's rule equivalent)
# 2 hours crying + 1 hour fussing = 3 hours. 4 days/week. Onset 1 month, resolved 4 months.
rome_iv_child_colic(2, 1, 4, 1, 4, 1)
# Example 2: Not Met (Insufficient frequency)
# 4 hours per day, but only 2 days/week
rome_iv_child_colic(4, 0, 2, 1, 4, 1)
Rome IV Diagnostic Criteria for Child Cyclic Vomiting Syndrome (CVS)
Description
Evaluates the **Rome IV criteria** for diagnosing **Cyclic Vomiting Syndrome (CVS)** in children and adolescents. Diagnosis requires recurrent, stereotypical episodes of vomiting with acute onset and return to baseline health between episodes, excluding organic causes.
Usage
rome_iv_child_cyclic_vomiting_syndrome(stereotypical_episodes, episode_count_6mo,
inter_episodic_wellness,
not_explained_by_other_condition,
symptom_onset_ge_6_months,
symptoms_active_last_3_months)
Arguments
stereotypical_episodes |
Numeric (0 or 1). Are episodes **stereotypical** in onset, duration (< 1 week), and frequency? (1 = Yes). |
episode_count_6mo |
Numeric. Number of discrete episodes in the **past 6 months**. (Must be >= 2). |
inter_episodic_wellness |
Numeric (0 or 1). Is there an **absence of vomiting** between episodes, with return to baseline health? (1 = Yes). |
not_explained_by_other_condition |
Numeric (0 or 1). Have other causes (e.g., GI, neurological, metabolic) been **excluded**? (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have criteria been fulfilled for the last **3 months**? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Cyclic Vomiting Syndrome (CVS)" or "Criteria Not Met". |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Diagnosis Met
# Stereotypical (1), 3 episodes in 6 months,
#Inter-episodic wellness (1), Excluded other causes, Chronic duration met
rome_iv_child_cyclic_vomiting_syndrome(1, 3, 1, 1, 1, 1)
# Example 2: Not Met (Vomiting between episodes)
# Stereotypical (1), 2+ episodes, Vomiting between episodes
#(0 for inter_episodic_wellness)
rome_iv_child_cyclic_vomiting_syndrome(1, 4, 0, 1, 1, 1)
Rome IV Diagnostic Criteria for Child Functional Abdominal Pain - NOS
Description
Evaluates the **Rome IV criteria** for diagnosing **Functional Abdominal Pain - Not Otherwise Specified (NOS)** in children and adolescents. This diagnosis is made when chronic or recurrent abdominal pain does not meet the full criteria for other specific functional abdominal pain disorders (e.g., IBS, Functional Dyspepsia, Abdominal Migraine).
Usage
rome_iv_child_functional_abdominal_pain(episodes_ge_4_days_month,
pain_localizes_to_periumbilical,
pain_associated_with_defecation,
loss_of_social_functioning,
intermittent_pain_free_periods,
no_organic_causes)
Arguments
episodes_ge_4_days_month |
Numeric (0 or 1). Recurrent abdominal pain occurring at least **4 days per month**. (1 = Yes). |
pain_localizes_to_periumbilical |
Numeric (0 or 1). Pain that **localizes to the periumbilical** area. (1 = Yes). |
pain_associated_with_defecation |
Numeric (0 or 1). Pain that is **NOT consistently associated with defecation** or does not meet criteria for another functional abdominal pain disorder. (1 = Associated/Meets other criteria). The **diagnosis requires the absence of this association**. |
loss_of_social_functioning |
Numeric (0 or 1). Pain associated with some loss of **social functioning**. (1 = Yes). |
intermittent_pain_free_periods |
Numeric (0 or 1). Presence of **intermittent pain-free periods**. (1 = Yes). |
no_organic_causes |
Numeric (0 or 1). After appropriate medical evaluation, are symptoms **NOT fully explained by another medical condition**? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Functional Abdominal Pain - NOS" or "Criteria Not Met". |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Diagnosis Met
# Pain >4 days/mo, Periumbilical, NOT associated with defecation (0),
#Social impact, Pain-free periods, No organic cause
rome_iv_child_functional_abdominal_pain(1, 1, 0, 1, 1, 1)
# Example 2: Not Met (Associated with Defecation)
# Pain >4 days/mo, Periumbilical, Associated with defecation (1)
rome_iv_child_functional_abdominal_pain(1, 1, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Child Functional Constipation
Description
Evaluates the **Rome IV criteria** for diagnosing **Functional Constipation** in children (4 years of age up to adolescence). Diagnosis requires the presence of at least **two** of the five specified symptoms for at least 1 month, and symptoms must not be attributable to an underlying medical condition. The presence of fecal incontinence determines the subtype.
Usage
rome_iv_child_functional_constipation(stool_frequency_lt_3_week, hard_lumpy_stool,
straining, large_diameter_stool,
rectal_fecal_mass, fecal_incontinence_present,
no_other_cause)
Arguments
stool_frequency_lt_3_week |
Numeric (0 or 1). **Two or fewer defecations** in the toilet per week. (1 = Yes). |
hard_lumpy_stool |
Numeric (0 or 1). History of passing **hard or lumpy stools** (Bristol Stool Form Scale 1-2) [Image of bristol stool scale chart] . (1 = Yes). |
straining |
Numeric (0 or 1). History of **straining** or holding back stools. (1 = Yes). |
large_diameter_stool |
Numeric (0 or 1). History of **large diameter stools** obstructing the toilet. (1 = Yes). |
rectal_fecal_mass |
Numeric (0 or 1). Presence of a **large fecal mass** in the rectum on examination. (1 = Yes). |
fecal_incontinence_present |
Numeric (0 or 1). Presence of **fecal incontinence** (at least 1 episode per week). (1 = Yes). |
no_other_cause |
Numeric (0 or 1). Have symptoms been active for at least 1 month and are NOT fully explained by another medical condition? (1 = Yes). |
Value
A list containing:
Diagnosis |
The resulting classification (Functional Constipation or Functional Constipation with Fecal Incontinence). |
Constipation_Criteria_Count |
The number of positive constipation criteria out of the five specified symptoms. |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Functional Constipation Only
# 2 stools/week (1), Hard stools (1), Straining (1), No incontinence, No other cause
# Score = 3 (Meets criteria for 2 or more)
rome_iv_child_functional_constipation(1, 1, 1, 0, 0, 0, 1)
# Example 2: Constipation with Incontinence
# Hard stools (1), Large stools (1), Fecal incontinence present (1), No other cause
# Score = 2 criteria + Incontinence present
rome_iv_child_functional_constipation(0, 1, 0, 1, 0, 1, 1)
Rome IV Diagnostic Criteria for Child Functional Dyspepsia
Description
Evaluates the **Rome IV criteria** for diagnosing **Functional Dyspepsia** in children and adolescents. Functional dyspepsia is sub-classified into Postprandial Distress Syndrome (PDS) and Epigastric Pain Syndrome (EPS). Diagnosis requires symptoms to be present for at least 3 months, with onset at least 6 months prior, and the absence of organic disease that explains the symptoms.
Usage
rome_iv_child_functional_dyspepsia(postprandial_fullness, early_satiation,
epigastric_pain, epigastric_burning,
organic_disease_excluded, symptom_onset_ge_6_months,
symptoms_active_last_3_months)
Arguments
postprandial_fullness |
Numeric (0 or 1). Presence of bothersome **postprandial fullness** (at least 4 days a week). (1 = Yes). This is a criterion for PDS. |
early_satiation |
Numeric (0 or 1). Presence of bothersome **early satiation** (at least 4 days a week). (1 = Yes). This is a criterion for PDS. |
epigastric_pain |
Numeric (0 or 1). Presence of bothersome **epigastric pain** (at least 1 day a week). (1 = Yes). This is a criterion for EPS. |
epigastric_burning |
Numeric (0 or 1). Presence of bothersome **epigastric burning** (at least 1 day a week). (1 = Yes). This is a criterion for EPS. |
organic_disease_excluded |
Numeric (0 or 1). Exclusion of organic disease (e.g., peptic ulcer, esophagitis) by upper endoscopy. (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last **3 months**? (1 = Yes). |
Value
A list containing:
Diagnosis |
The resulting classification (PDS, EPS, Overlap, or Not Met). |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Postprandial Distress Syndrome (PDS)
# Fullness (1), Early Satiation (0), No pain/burning, Organic excluded, Chronic duration met
rome_iv_child_functional_dyspepsia(1, 0, 0, 0, 1, 1, 1)
# Example 2: Overlap Dyspepsia
# Fullness (1), Pain (1), Organic excluded, Chronic duration met
rome_iv_child_functional_dyspepsia(1, 0, 1, 0, 1, 1, 1)
Rome IV Diagnostic Criteria for Child Irritable Bowel Syndrome (IBS)
Description
Evaluates the Rome IV criteria for diagnosing Irritable Bowel Syndrome (IBS) in children and adolescents. Diagnosis requires abdominal pain at least 4 days per month associated with defecation or changes in stool, that cannot be fully explained by another medical condition or functional constipation.
Usage
rome_iv_child_ibs(pain_frequency_days_month, related_to_defecation,
change_stool_frequency, change_stool_form,
pain_resolves_with_constipation_resolution,
medical_condition_explained)
Arguments
pain_frequency_days_month |
Numeric. Frequency of abdominal pain in days per month (must be >= 4). |
related_to_defecation |
Numeric (0 or 1). Is the pain related to defecation? (1 = Yes). |
change_stool_frequency |
Numeric (0 or 1). Is the pain associated with a change in frequency of stool? (1 = Yes). |
change_stool_form |
Numeric (0 or 1). Is the pain associated with a change in form (appearance) of stool? (1 = Yes). |
pain_resolves_with_constipation_resolution |
Numeric (0 or 1). In children with constipation, does the pain resolve with resolution of the constipation? (1 = Yes, this excludes IBS diagnosis in favor of functional constipation). |
medical_condition_explained |
Numeric (0 or 1). Can symptoms be fully explained by another medical condition? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Irritable Bowel Syndrome (IBS)" or "Criteria Not Met". |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Criteria Met
# Pain 5 days/mo, related to defecation, not constipation-only, no other cause
rome_iv_child_ibs(5, 1, 0, 0, 0, 0)
# Example 2: Not Met (Pain resolves with constipation treatment)
# Pain 10 days/mo, change in form, but resolves when constipation fixed
rome_iv_child_ibs(10, 0, 0, 1, 1, 0)
Rome IV Diagnostic Criteria for Functional Nausea and Vomiting (Child/Adolescent)
Description
Evaluates the Rome IV criteria for diagnosing functional nausea and vomiting in children and adolescents. Diagnosis requires bothersome nausea or vomiting at least twice a week for at least 2 months, exclusion of self-induced vomiting, eating disorders, and other medical explanations.
Usage
rome_iv_child_nausea_vomiting(bothersome_nausea_frequency,
bothersome_vomiting_frequency, self_induced_vomiting,
eating_disorder, medical_condition_explained)
Arguments
bothersome_nausea_frequency |
Numeric. Frequency of bothersome nausea. 0: Never/Rarely. 1: Once a week. 2: Twice a week or more. |
bothersome_vomiting_frequency |
Numeric. Frequency of bothersome vomiting. 0: Never/Rarely. 1: Once a week. 2: Twice a week or more. |
self_induced_vomiting |
Numeric (0 or 1). Is the vomiting self-induced? (1 = Yes). |
eating_disorder |
Numeric (0 or 1). Can symptoms be explained by an eating disorder? (1 = Yes). |
medical_condition_explained |
Numeric (0 or 1). Can symptoms be explained by another medical condition (e.g., anatomic, metabolic, neoplastic)? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met" or "Criteria Not Met". |
Criteria_Check |
Boolean breakdown of symptom threshold and exclusion criteria. |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Diagnosis Met
# Nausea 2x/week (2), No vomiting (0), No exclusions
rome_iv_child_nausea_vomiting(2, 0, 0, 0, 0)
# Example 2: Not Met (Eating Disorder)
# Vomiting 2x/week (2), Eating Disorder present (1)
rome_iv_child_nausea_vomiting(0, 2, 0, 1, 0)
Rome IV Diagnostic Criteria for Child Non-Retentive Fecal Incontinence
Description
Evaluates the Rome IV criteria for diagnosing non-retentive fecal incontinence in children and adolescents. This functional gastrointestinal disorder involves the passage of feces in inappropriate places without evidence of fecal retention (constipation).
Usage
rome_iv_child_non_retentive_fecal_incontinence(incontinence_frequency,
fecal_retention,
developmental_age_years,
symptom_duration_months,
medical_condition_explained)
Arguments
incontinence_frequency |
Numeric. Number of episodes of defecation into places inappropriate to the social context per month. (Must be >= 1). |
fecal_retention |
Numeric (0 or 1). Is there evidence of fecal retention (e.g., retentive posturing, large diameter stools, fecal mass)? (1 = Yes). This excludes the diagnosis (points towards Functional Constipation with Incontinence). |
developmental_age_years |
Numeric. The child's developmental age in years. (Must be >= 4 years). |
symptom_duration_months |
Numeric. Duration of symptoms in months. (Must be >= 1 month). |
medical_condition_explained |
Numeric (0 or 1). Can the symptoms be explained by another medical condition (e.g., inflammatory, anatomic, metabolic, or neoplastic)? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Non-Retentive Fecal Incontinence" or "Criteria Not Met". |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Diagnosis Met
# 1 episode/mo, No retention, Age 6, Duration 2 mo, No other cause
rome_iv_child_non_retentive_fecal_incontinence(1, 0, 6, 2, 0)
# Example 2: Not Met (Retention Present - likely Constipation)
# 4 episodes/mo, Retention Yes, Age 5, Duration 3 mo
rome_iv_child_non_retentive_fecal_incontinence(4, 1, 5, 3, 0)
Rome IV Diagnostic Criteria for Child Rumination Syndrome
Description
Evaluates the Rome IV criteria for diagnosing Rumination Syndrome in children and adolescents. Diagnosis requires repeated regurgitation and re-chewing or expulsion of food starting soon after ingestion, not during sleep, not preceded by retching, and not explained by another medical condition or eating disorder.
Usage
rome_iv_child_rumination_syndrome(symptom_duration_months,
repeated_regurgitation,
starts_soon_after_meal,
does_not_occur_during_sleep,
no_retching_preceding,
not_explained_by_medical_condition)
Arguments
symptom_duration_months |
Numeric. Duration of symptoms in months (Must be >= 2 months). |
repeated_regurgitation |
Numeric (0 or 1). Is there repeated regurgitation and re-chewing or expulsion of food? (1 = Yes). |
starts_soon_after_meal |
Numeric (0 or 1). Does the regurgitation begin soon after ingestion of a meal? (1 = Yes). |
does_not_occur_during_sleep |
Numeric (0 or 1). Does the regurgitation NOT occur during sleep? (1 = Yes, it does not occur during sleep). |
no_retching_preceding |
Numeric (0 or 1). Is the regurgitation NOT preceded by retching? (1 = Yes, no preceding retching). |
not_explained_by_medical_condition |
Numeric (0 or 1). Are symptoms NOT better explained by another medical condition (e.g., GERD, eosinophilic esophagitis) or eating disorder? (1 = Yes, not explained by others). |
Value
A list containing:
Diagnosis |
"Criteria Met for Rumination Syndrome" or "Criteria Not Met". |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Diagnosis Met
# 3 months duration, Regurgitation, After meal, Not sleep, No retching, No other cause
rome_iv_child_rumination_syndrome(3, 1, 1, 1, 1, 1)
# Example 2: Not Met (Occurs during sleep or retching present)
# 3 months, Retching precedes (0 for no_retching), Occurs during sleep (0 for not_during_sleep)
rome_iv_child_rumination_syndrome(3, 1, 1, 0, 0, 1)
Rome IV Diagnostic Criteria for Chronic Nausea Vomiting Syndrome (CNVS)
Description
Evaluates the Rome IV criteria for diagnosing Chronic Nausea Vomiting Syndrome (CNVS). Diagnosis requires bothersome nausea and/or vomiting at least 1 day per week, exclusion of self-induced vomiting, eating disorders, regurgitation, and rumination, absence of organic disease, and symptom duration of at least 3 months with onset at least 6 months prior.
Usage
rome_iv_cnvs(nausea_at_least_1_day_per_week, vomiting_at_least_1_day_per_week,
self_induced_vomiting_present, eating_disorder_present,
regurgitation_present, rumination_present,
organic_systemic_metabolic_disease_excluded,
symptom_onset_ge_6_months_ago, symptoms_active_last_3_months)
Arguments
nausea_at_least_1_day_per_week |
Numeric (0 or 1). Is bothersome nausea present at least 1 day per week? (1 = Yes). |
vomiting_at_least_1_day_per_week |
Numeric (0 or 1). Is there one or more vomiting episodes per week? (1 = Yes). |
self_induced_vomiting_present |
Numeric (0 or 1). Is the vomiting self-induced? (1 = Yes). This excludes CNVS. |
eating_disorder_present |
Numeric (0 or 1). Is an eating disorder present? (1 = Yes). This excludes CNVS. |
regurgitation_present |
Numeric (0 or 1). Is regurgitation present? (1 = Yes). This excludes CNVS. |
rumination_present |
Numeric (0 or 1). Is rumination present? (1 = Yes). This excludes CNVS. |
organic_systemic_metabolic_disease_excluded |
Numeric (0 or 1). Have organic, systemic, or metabolic diseases been excluded (e.g., by upper endoscopy)? (1 = Yes). |
symptom_onset_ge_6_months_ago |
Numeric (0 or 1). Did symptoms start at least 6 months ago? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Chronic Nausea Vomiting Syndrome (CNVS)" or "Criteria Not Met". |
References
Stanghellini V, Chan FK, Hasler WL, et al. Gastroduodenal Disorders. Gastroenterology. 2016;150:1380-1392. doi:10.1053/j.gastro.2016.02.011
Examples
# Example 1: Criteria Met
# Nausea 1/wk (1), No vomiting (0), Exclusions clear (0), Disease excluded (1), Duration met (1,1)
rome_iv_cnvs(1, 0, 0, 0, 0, 0, 1, 1, 1)
# Example 2: Criteria Not Met (Duration too short)
# Nausea 1/wk (1), No vomiting (0), Exclusions clear (0), Disease excluded (1), Onset <6mo (0)
rome_iv_cnvs(1, 0, 0, 0, 0, 0, 1, 0, 1)
Rome IV Diagnostic Criteria for Cyclic Vomiting Syndrome (CVS)
Description
Evaluates the Rome IV diagnostic criteria for Cyclic Vomiting Syndrome (CVS). Diagnosis requires stereotypical episodes of acute onset vomiting lasting less than 1 week, occurring at least 3 times in the prior year, with absence of vomiting between episodes. Symptoms must have started at least 6 months ago and be active within the last 3 months.
Usage
rome_iv_cyclic_vomiting_syndrome(stereotypical_episodes, episode_count_12mo,
episodes_separated_1wk, inter_episodic_wellness,
symptom_onset_6mo, active_symptoms_3mo)
Arguments
stereotypical_episodes |
Numeric (0 or 1). Are episodes stereotypical regarding onset (acute) and duration (< 1 week)? (1 = Yes). |
episode_count_12mo |
Numeric. Number of discrete episodes in the prior year. (Must be >= 3). |
episodes_separated_1wk |
Numeric (0 or 1). Did the episodes occur at least 1 week apart? (1 = Yes). |
inter_episodic_wellness |
Numeric (0 or 1). Is there an absence of vomiting between episodes? (1 = Yes). |
symptom_onset_6mo |
Numeric (0 or 1). Did symptoms onset at least 6 months ago? (1 = Yes). |
active_symptoms_3mo |
Numeric (0 or 1). Have criteria been fulfilled for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Cyclic Vomiting Syndrome (CVS)" or "Criteria Not Met". |
References
Stanghellini V, Chan FK, Hasler WL, et al. Gastroduodenal Disorders. Gastroenterology. 2016;150:1380-1392. doi:10.1053/j.gastro.2016.02.011
Examples
# Example 1: Criteria Met
# Stereotypical(1), 4 episodes, Separated(1), Wellness(1), Duration met
rome_iv_cyclic_vomiting_syndrome(1, 4, 1, 1, 1, 1)
# Example 2: Not Met (Insufficient episodes)
# Stereotypical(1), 2 episodes, Separated(1), Wellness(1), Duration met
rome_iv_cyclic_vomiting_syndrome(1, 2, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Fecal Incontinence
Description
Evaluates the Rome IV criteria for the diagnosis of Fecal Incontinence. Diagnosis requires the recurrent uncontrolled passage of fecal material in an individual with a developmental age of at least 4 years, with symptom onset at least 6 months prior and active symptoms for the last 3 months, after excluding organic causes.
Usage
rome_iv_fecal_incontinence(recurrent_uncontrolled_passage, developmental_age_ge_4,
symptom_onset_ge_6mo, active_symptoms_3mo,
organic_causes_excluded)
Arguments
recurrent_uncontrolled_passage |
Numeric (0 or 1). Is there recurrent uncontrolled passage of fecal material? (1 = Yes). |
developmental_age_ge_4 |
Numeric (0 or 1). Is the individual's developmental age at least 4 years? (1 = Yes). |
symptom_onset_ge_6mo |
Numeric (0 or 1). Did symptoms begin at least 6 months ago? (1 = Yes). |
active_symptoms_3mo |
Numeric (0 or 1). Have criteria been fulfilled for the last 3 months? (1 = Yes). |
organic_causes_excluded |
Numeric (0 or 1). Have structural or other organic causes been excluded by appropriate medical evaluation? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Fecal Incontinence" or "Criteria Not Met". |
References
Rao SS, Bharucha AE, Chiarioni G, et al. Anorectal Disorders. Gastroenterology. 2016;150:1430-1442. doi:10.1053/j.gastro.2016.02.009
Examples
# Example 1: Criteria Met
# Recurrent passage, Age 45, Duration met, Organic causes ruled out
rome_iv_fecal_incontinence(1, 1, 1, 1, 1)
# Example 2: Not Met (Duration too short)
# Recurrent passage, Age 45, Onset 1 month ago (0)
rome_iv_fecal_incontinence(1, 1, 0, 1, 1)
Rome IV Diagnostic Criteria for Functional Anorectal Pain
Description
Evaluates the Rome IV criteria for diagnosing Functional Anorectal Pain disorders, specifically distinguishing between Levator Ani Syndrome and Unspecified Functional Anorectal Pain. Diagnosis requires chronic/recurrent rectal pain lasting at least 30 minutes, exclusion of organic causes, and symptom chronicity (onset >= 6 months, active >= 3 months).
Usage
rome_iv_functional_anorectal_pain(chronic_rectal_pain, duration_ge_30_min,
tenderness_puborectalis, organic_causes_excluded,
symptom_onset_ge_6_months,
symptoms_active_last_3_months)
Arguments
chronic_rectal_pain |
Numeric (0 or 1). Presence of chronic or recurrent rectal pain or aching. (1 = Yes). |
duration_ge_30_min |
Numeric (0 or 1). Do episodes last 30 minutes or longer? (1 = Yes). |
tenderness_puborectalis |
Numeric (0 or 1). Is there tenderness during posterior traction on the puborectalis muscle? (1 = Yes). Used to differentiate Levator Ani Syndrome from Unspecified Functional Anorectal Pain. |
organic_causes_excluded |
Numeric (0 or 1). Have other causes (e.g., ischemia, inflammatory bowel disease, cryptitis, hemorrhoids, anal fissures, tumor) been excluded? (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptoms start at least 6 months ago? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
Diagnostic result ("Levator Ani Syndrome", "Unspecified Functional Anorectal Pain", or "Criteria Not Met"). |
References
Rao SS, Bharucha AE, Chiarioni G, et al. Anorectal Disorders. Gastroenterology. 2016;150:1430-1442. doi:10.1053/j.gastro.2016.02.009
Examples
# Example 1: Levator Ani Syndrome
# Chronic pain (1), >30 min (1), Tenderness (1), Exclusions (1), Chronicity (1,1)
rome_iv_functional_anorectal_pain(1, 1, 1, 1, 1, 1)
# Example 2: Unspecified Functional Anorectal Pain
# Chronic pain (1), >30 min (1), No tenderness (0), Exclusions (1), Chronicity (1,1)
rome_iv_functional_anorectal_pain(1, 1, 0, 1, 1, 1)
# Example 3: Criteria Not Met (Duration too short)
# Pain <30 min (0)
rome_iv_functional_anorectal_pain(1, 0, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Functional Biliary Sphincter of Oddi Disorder (SOD)
Description
Evaluates the Rome IV diagnostic criteria for Functional Biliary Sphincter of Oddi Disorder (SOD), which is characterized by recurrent episodes of biliary pain in the absence of structural or metabolic explanations. The diagnosis is based on a set of general criteria, with manometry used for subtype classification.
Usage
rome_iv_functional_biliary_sod(episode_pain, other_pain_excluded,
normal_liver_enzymes, normal_pancreatic_enzymes,
normal_imaging, not_explained_by_other_condition,
manometry_normal_or_high)
Arguments
episode_pain |
Numeric (0 or 1). Presence of recurrent episodes of biliary pain (pain in the epigastrium and/or right upper quadrant, meeting specific characteristics). (1 = Yes). |
other_pain_excluded |
Numeric (0 or 1). Have other causes of abdominal pain been excluded? (1 = Yes). |
normal_liver_enzymes |
Numeric (0 or 1). Is there documentation of normal liver enzymes (ALT/AST, ALP) and bilirubin? (1 = Yes). |
normal_pancreatic_enzymes |
Numeric (0 or 1). Is there documentation of normal pancreatic enzymes (amylase/lipase)? (1 = Yes). |
normal_imaging |
Numeric (0 or 1). Is there documentation of normal transabdominal ultrasound or Endoscopic Ultrasound (EUS) with no structural abnormalities? (1 = Yes). |
not_explained_by_other_condition |
Numeric (0 or 1). Are symptoms NOT fully explained by another medical condition (e.g., celiac disease, peptic ulcer)? (1 = Yes). |
manometry_normal_or_high |
Numeric (0 or 1). Does Sphincter of Oddi manometry show elevated basal pressure or a normal pressure (used for subtyping)? (1 = Yes, pressure is high or normal). |
Value
A list containing:
Diagnosis |
The diagnostic result, including subtype based on presumed manometry results (Type I/II if positive manometry, Type III if negative/manometry not done). |
References
Corazziari E, Shaffer EA, Hogan WJ, et al. Functional Disorders of the Gallbladder and Sphincter of Oddi. Gastroenterology. 2016;150:1443-1455. doi:10.1053/j.gastro.2016.02.044
Examples
# Example 1: Type I/II SOD (General criteria met + positive manometry)
rome_iv_functional_biliary_sod(1, 1, 1, 1, 1, 1, 1)
# Example 2: Type III SOD (General criteria met + negative/unknown manometry)
rome_iv_functional_biliary_sod(1, 1, 1, 1, 1, 1, 0)
Rome IV Diagnostic Criteria for Functional Abdominal Bloating/Distension
Description
Evaluates the Rome IV criteria for diagnosing Functional Abdominal Bloating/Distension. Diagnosis requires recurrent bloating and/or distension occurring at least 1 day/week, which predominates over other symptoms, in the absence of criteria for IBS, functional constipation, functional diarrhea, or postprandial distress syndrome. Symptoms must have started at least 6 months ago and been active for the last 3 months.
Usage
rome_iv_functional_bloating_distension(bloating_distension_ge_1_day_week,
symptoms_predominate,
criteria_for_other_fgid_met,
symptom_onset_ge_6_months,
symptoms_active_last_3_months)
Arguments
bloating_distension_ge_1_day_week |
Numeric (0 or 1). Recurrent bloating and/or distension occurring on average at least 1 day per week. (1 = Yes). |
symptoms_predominate |
Numeric (0 or 1). Do abdominal bloating and/or distension predominate over other symptoms? (1 = Yes). Note: Mild pain related to bloating/distension is allowed. |
criteria_for_other_fgid_met |
Numeric (0 or 1). Does the patient meet criteria for Irritable Bowel Syndrome (IBS), Functional Constipation, Functional Diarrhea, or Postprandial Distress Syndrome? (1 = Yes). Note: A "Yes" here excludes Functional Bloating/Distension. |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least 6 months prior to diagnosis? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been present for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Functional Abdominal Bloating/Distension" or "Criteria Not Met". |
References
Lacy BE, Mearin F, Chang L, et al. Bowel Disorders. Gastroenterology. 2016;150:1393-1407. doi:10.1053/j.gastro.2016.02.031
Examples
# Example 1: Diagnosis Met
# Bloating >1/wk, Predominates, No other FGID, Chronic duration
rome_iv_functional_bloating_distension(1, 1, 0, 1, 1)
# Example 2: Not Met (Meets IBS criteria)
# Bloating present, but IBS criteria also met (1)
rome_iv_functional_bloating_distension(1, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Functional Chest Pain
Description
Evaluates the Rome IV criteria for diagnosing Functional Chest Pain of presumed esophageal origin. Diagnosis requires recurrent retrosternal chest pain (not heartburn) that is not explained by organic esophageal disease (e.g., structural, motility, or reflux disease). Symptoms must be chronic (onset >= 6 months, active >= 3 months).
Usage
rome_iv_functional_chest_pain(retrosternal_pain, other_esophageal_symptoms,
normal_egd, normal_esophageal_motility,
esophageal_reflux_excluded, symptom_onset_ge_6_months,
symptoms_active_last_3_months)
Arguments
retrosternal_pain |
Numeric (0 or 1). Presence of retrosternal pain or discomfort. (1 = Yes). |
other_esophageal_symptoms |
Numeric (0 or 1). Presence of associated esophageal symptoms (e.g., heartburn, dysphagia). (1 = Yes). Note: The diagnosis requires the *absence* of these secondary symptoms. |
normal_egd |
Numeric (0 or 1). Normal Esophagogastroduodenoscopy (EGD) (ruling out structural/mucosal lesions like esophagitis, ulcers). (1 = Yes). |
normal_esophageal_motility |
Numeric (0 or 1). Normal esophageal motility (ruling out major motor disorders like achalasia, spasm). (1 = Yes). |
esophageal_reflux_excluded |
Numeric (0 or 1). Absence of evidence that gastroesophageal reflux (GERD) is the cause of the symptom (e.g., negative pH monitoring or symptom relief with PPIs). (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least 6 months prior to diagnosis? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Functional Chest Pain" or "Criteria Not Met". |
References
Vakil N, van Zanten SV, Kahrilas P, et al. The Montreal definition and classification of gastroesophageal reflux disease: a global evidence-based consensus. Am J Gastroenterol. 2006;101(8):1900-1920. Aben-Fawaz H, Kahrilas PJ, Chen J. Esophageal disorders. Gastroenterology. 2016;150:1367-1379. doi:10.1053/j.gastro.2016.02.002
Examples
# Example 1: Diagnosis Met
# Retrosternal pain (1), No other Sx (0), Normal EGD (1),
#Normal Motility (1), Reflux excluded (1), Chronic duration
rome_iv_functional_chest_pain(1, 0, 1, 1, 1, 1, 1)
# Example 2: Not Met (Has heartburn)
# Retrosternal pain (1), Has heartburn (1), Normal EGD (1),
#Normal Motility (1), Reflux excluded (1), Chronic duration
rome_iv_functional_chest_pain(1, 1, 1, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Functional Constipation
Description
Evaluates the Rome IV criteria for diagnosing Functional Constipation in adults. Diagnosis requires the presence of at least two of the six specified symptoms in at least 25% of defecations (over the last 3 months with symptom onset at least 6 months prior) AND the absence of sufficient criteria for Irritable Bowel Syndrome (IBS).
Usage
rome_iv_functional_constipation(stool_frequency_lt_2_week, straining_ge_25_percent,
lumpy_hard_stool_ge_25_percent,
sensation_incomplete_evacuation_ge_25_percent,
sensation_anorectal_blockage_ge_25_percent,
manual_maneuver_ge_25_percent,
loose_stool_absent, sufficient_criteria_met)
Arguments
stool_frequency_lt_2_week |
Numeric (0 or 1). Less than 3 spontaneous bowel movements per week. (1 = Yes). |
straining_ge_25_percent |
Numeric (0 or 1). Straining during at least 25% of defecations. (1 = Yes). |
lumpy_hard_stool_ge_25_percent |
Numeric (0 or 1). Lumpy or hard stools (Bristol Stool Form Scale 1 or 2) in at least 25% of defecations. (1 = Yes). |
sensation_incomplete_evacuation_ge_25_percent |
Numeric (0 or 1). Sensation of incomplete evacuation in at least 25% of defecations. (1 = Yes). |
sensation_anorectal_blockage_ge_25_percent |
Numeric (0 or 1). Sensation of anorectal obstruction/blockage in at least 25% of defecations. (1 = Yes). |
manual_maneuver_ge_25_percent |
Numeric (0 or 1). Manual maneuvers to facilitate at least 25% of defecations (e.g., digital evacuation, support of the pelvic floor). (1 = Yes). |
loose_stool_absent |
Numeric (0 or 1). Loose stools are rarely present without the use of laxatives. (1 = Yes). This is a required exclusion of IBS-D. |
sufficient_criteria_met |
Numeric (0 or 1). Do at least two of the six bulleted criteria (Q1-Q6) occur? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Functional Constipation" or "Criteria Not Met". |
Criteria_Count |
The number of positive criteria out of the six specified symptoms. |
References
Lacy BE, Mearin F, Chang L, et al. Bowel Disorders. Gastroenterology. 2016;150:1393-1407. doi:10.1053/j.gastro.2016.02.031
Examples
# Example 1: Diagnosis Met
# <3 stools/week, Straining, Hard stools,
#Incomplete evacuation. No loose stools. Sufficient criteria met.
rome_iv_functional_constipation(1, 1, 1, 1, 0, 0, 1, 1)
# Example 2: Not Met (Loose stools present)
# All criteria met except loose stools are present (0)
rome_iv_functional_constipation(1, 1, 1, 0, 0, 0, 0, 1)
Rome IV Diagnostic Criteria for Functional Defecation Disorders
Description
Evaluates the Rome IV criteria for diagnosing Functional Defecation Disorders (FDD). These disorders are characterized by a set of defecatory symptoms (straining, incomplete evacuation, etc.) along with objective evidence of impaired defecatory dynamics on anorectal function testing (e.g., manometry or balloon expulsion). The diagnosis requires at least two out of four core symptoms, objective testing evidence, and exclusion of organic causes.
Usage
rome_iv_functional_defecation_disorders(straining_ge_25_percent,
sensation_incomplete_evacuation_ge_25_percent,
sensation_anorectal_blockage_ge_25_percent,
manual_maneuver_ge_25_percent,
inadequate_defecatory_propulsion,
dyssynergic_defecation, other_conditions_excluded)
Arguments
straining_ge_25_percent |
Numeric (0 or 1). Straining during at least 25% of defecations. (1 = Yes). |
sensation_incomplete_evacuation_ge_25_percent |
Numeric (0 or 1). Sensation of incomplete evacuation in at least 25% of defecations. (1 = Yes). |
sensation_anorectal_blockage_ge_25_percent |
Numeric (0 or 1). Sensation of anorectal obstruction/blockage in at least 25% of defecations. (1 = Yes). |
manual_maneuver_ge_25_percent |
Numeric (0 or 1). Use of manual maneuvers to facilitate at least 25% of defecations. (1 = Yes). |
inadequate_defecatory_propulsion |
Numeric (0 or 1). Objective evidence of impaired propulsion (e.g., ineffective pushing phase on manometry). (1 = Yes). |
dyssynergic_defecation |
Numeric (0 or 1). Objective evidence of dyssynergia (e.g., paradoxical puborectalis contraction or inadequate relaxation). (1 = Yes). |
other_conditions_excluded |
Numeric (0 or 1). Organic causes for the symptoms excluded (e.g., neoplasm, IBS). (1 = Yes). |
Value
A list containing:
Diagnosis |
The resulting FDD subtype (Inadequate Defecatory Propulsion, Dyssynergic Defecation, or General FDD). |
References
Rao SS, Bharucha AE, Chiarioni G, et al. Anorectal Disorders. Gastroenterology. 2016;150:1430-1442. doi:10.1053/j.gastro.2016.02.009
Examples
# Example 1: Dyssynergic Defecation
# Two symptoms met (Q1, Q3), Dyssynergia confirmed by testing
rome_iv_functional_defecation_disorders(1, 0, 1, 0, 0, 1, 1)
# Example 2: Inadequate Defecatory Propulsion
# Three symptoms met, Propulsion inadequacy confirmed
rome_iv_functional_defecation_disorders(1, 1, 1, 0, 1, 0, 1)
Rome IV Diagnostic Criteria for Functional Diarrhea
Description
Evaluates the Rome IV criteria for diagnosing Functional Diarrhea. Diagnosis requires the recurrent passage of loose or watery stools in more than 25% of defecations, with hard or lumpy stools in less than 25% of defecations, and criteria for Irritable Bowel Syndrome (IBS) are not met. Symptoms must have started at least 6 months ago and been active for the last 3 months.
[Image of bristol stool scale chart]
Usage
rome_iv_functional_diarrhea(loose_watery_stool_ge_25_percent,
hard_lumpy_stool_lt_25_percent, meets_ibs_criteria,
symptom_onset_ge_6_months, symptoms_active_last_3_months)
Arguments
loose_watery_stool_ge_25_percent |
Numeric (0 or 1). Are loose or watery stools (Bristol Stool Form 6-7) present in >25% of bowel movements? (1 = Yes). |
hard_lumpy_stool_lt_25_percent |
Numeric (0 or 1). Are hard or lumpy stools (Bristol Stool Form 1-2) present in <25% of bowel movements? (1 = Yes). |
meets_ibs_criteria |
Numeric (0 or 1). Does the patient meet diagnostic criteria for Irritable Bowel Syndrome (IBS), specifically regarding predominant abdominal pain? (1 = Yes). Note: Meeting IBS criteria excludes Functional Diarrhea. |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least 6 months prior to diagnosis? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been present for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Functional Diarrhea" or "Criteria Not Met". |
References
Lacy BE, Mearin F, Chang L, et al. Bowel Disorders. Gastroenterology. 2016;150:1393-1407. doi:10.1053/j.gastro.2016.02.031
Examples
# Example 1: Diagnosis Met
# Loose stools >25%, No hard stools, No IBS, Chronic
rome_iv_functional_diarrhea(1, 1, 0, 1, 1)
# Example 2: Not Met (Meets IBS)
# Loose stools present, but IBS pain criteria also met
rome_iv_functional_diarrhea(1, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Functional Dyspepsia
Description
Evaluates the Rome IV criteria for diagnosing Functional Dyspepsia. Diagnosis requires one or both of the main syndromes (Postprandial Distress Syndrome or Epigastric Pain Syndrome) for at least 3 months, with onset at least 6 months ago, and no evidence of organic disease that explains the symptoms.
Usage
rome_iv_functional_dyspepsia(postprandial_fullness, early_satiation,
epigastric_pain, epigastric_burning,
organic_disease_excluded, symptom_onset_ge_6_months,
symptoms_active_last_3_months)
Arguments
postprandial_fullness |
Numeric (0 or 1). Bothersome postprandial fullness (severe enough to impact usual activities) at least 3 days a week. (1 = Yes). |
early_satiation |
Numeric (0 or 1). Bothersome early satiation (severe enough to prevent finishing a regular-sized meal) at least 3 days a week. (1 = Yes). |
epigastric_pain |
Numeric (0 or 1). Bothersome epigastric pain (severe enough to impact usual activities) at least 1 day a week. (1 = Yes). |
epigastric_burning |
Numeric (0 or 1). Bothersome epigastric burning (severe enough to impact usual activities) at least 1 day a week. (1 = Yes). |
organic_disease_excluded |
Numeric (0 or 1). Exclusion of organic disease (e.g., peptic ulcer, cancer) via upper endoscopy. (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least 6 months prior to diagnosis? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
The resulting classification (PDS, EPS, Overlap, or Not Met). |
References
Stanghellini V, Chan FK, Hasler WL, et al. Gastroduodenal Disorders. Gastroenterology. 2016;150:1380-1392. doi:10.1053/j.gastro.2016.02.011
Examples
# Example 1: Postprandial Distress Syndrome (PDS)
# Fullness (1), Early Satiation (0), No pain/burning, Organic excluded, Chronic
rome_iv_functional_dyspepsia(1, 0, 0, 0, 1, 1, 1)
# Example 2: Epigastric Pain Syndrome (EPS)
# No fullness/satiation, Pain (1), Burning (0), Organic excluded, Chronic
rome_iv_functional_dyspepsia(0, 0, 1, 0, 1, 1, 1)
# Example 3: Overlap Dyspepsia
# Fullness (1), Pain (1), Organic excluded, Chronic
rome_iv_functional_dyspepsia(1, 0, 1, 0, 1, 1, 1)
Rome IV Diagnostic Criteria for Functional Dysphagia
Description
Evaluates the Rome IV criteria for diagnosing Functional Dysphagia. Diagnosis requires persistent difficulty swallowing (dysphagia), typically for solids only, that is non-odynophagic (not painful) and not explained by organic disease (structural, Eosinophilic Esophagitis, GERD, or major motility disorders). Symptoms must be chronic (onset >= 6 months, active >= 3 months).
Usage
rome_iv_functional_dysphagia(non_odynophagia_dysphagia, swallowing_solids_only,
no_structural_obstruction, no_eosinophilic_esophagitis,
no_gerd, no_major_motility_disorder,
symptom_onset_ge_6_months, symptoms_active_last_3_months)
Arguments
non_odynophagia_dysphagia |
Numeric (0 or 1). Presence of dysphagia that is non-odynophagic (not painful). (1 = Yes). |
swallowing_solids_only |
Numeric (0 or 1). Does the dysphagia occur primarily for solid foods, not liquids? (1 = Yes). |
no_structural_obstruction |
Numeric (0 or 1). Has structural obstruction (e.g., stricture, mass) been excluded by upper endoscopy? (1 = Yes). |
no_eosinophilic_esophagitis |
Numeric (0 or 1). Has Eosinophilic Esophagitis (EoE) been excluded? (1 = Yes). |
no_gerd |
Numeric (0 or 1). Has Gastroesophageal Reflux Disease (GERD) been excluded (e.g., negative pH monitoring, no response to PPI)? (1 = Yes). |
no_major_motility_disorder |
Numeric (0 or 1). Have major esophageal motility disorders (e.g., achalasia, spasm) been excluded by manometry? (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least 6 months prior to diagnosis? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Functional Dysphagia" or "Criteria Not Met". |
References
Aben-Fawaz H, Kahrilas PJ, Chen J. Esophageal disorders. Gastroenterology. 2016;150:1367-1379. doi:10.1053/j.gastro.2016.02.002
Examples
# Example 1: Diagnosis Met
# All exclusion criteria and symptom characteristics are met and chronic
rome_iv_functional_dysphagia(1, 1, 1, 1, 1, 1, 1, 1)
# Example 2: Not Met (Major Motility Disorder Present)
# All criteria met except manometry shows achalasia (0)
rome_iv_functional_dysphagia(1, 1, 1, 1, 1, 0, 1, 1)
Rome IV Diagnostic Criteria for Functional Gallbladder Disorder
Description
Evaluates the Rome IV diagnostic criteria for Functional Gallbladder Disorder (FGD), a functional biliary disorder characterized by pain of presumed biliary origin in the absence of gallstones or structural abnormality, and objective evidence of impaired gallbladder motility.
Usage
rome_iv_functional_gallbladder_disorder(biliary_pain, normal_liver_enzymes,
normal_pancreatic_enzymes, normal_imaging,
low_ejection_fraction,
not_explained_by_other_condition,
symptom_onset_ge_6_months,
symptoms_active_last_3_months)
Arguments
biliary_pain |
Numeric (0 or 1). Presence of recurrent episodes of biliary pain (pain in the epigastrium and/or right upper quadrant). (1 = Yes). |
normal_liver_enzymes |
Numeric (0 or 1). Is there documentation of normal liver enzymes (ALT/AST, ALP) and conjugated bilirubin? (1 = Yes). |
normal_pancreatic_enzymes |
Numeric (0 or 1). Is there documentation of normal pancreatic enzymes (amylase/lipase)? (1 = Yes). |
normal_imaging |
Numeric (0 or 1). Is there documentation of no gallstones or other structural pathology on transabdominal ultrasound? (1 = Yes). |
low_ejection_fraction |
Numeric (0 or 1). Is the gallbladder ejection fraction low (<38% or site-specific abnormal cutoff) on cholecystokinin-stimulated scintigraphy (HIDA scan)? (1 = Yes). |
not_explained_by_other_condition |
Numeric (0 or 1). Are symptoms NOT fully explained by another medical condition (e.g., peptic ulcer disease, GERD, coronary artery disease)? (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least 6 months prior to diagnosis? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Functional Gallbladder Disorder" or "Criteria Not Met". |
References
Corazziari E, Shaffer EA, Hogan WJ, et al. Functional Disorders of the Gallbladder and Sphincter of Oddi. Gastroenterology. 2016;150:1443-1455. doi:10.1053/j.gastro.2016.02.044
Examples
# Example 1: Diagnosis Met
# All organic causes excluded, typical pain, and low EF documented
rome_iv_functional_gallbladder_disorder(1, 1, 1, 1, 1, 1, 1, 1)
# Example 2: Not Met (EF normal)
# All structural/lab criteria met, but EF is normal (0)
rome_iv_functional_gallbladder_disorder(1, 1, 1, 1, 0, 1, 1, 1)
Rome IV Diagnostic Criteria for Functional Globus
Description
Evaluates the Rome IV criteria for diagnosing Functional Globus (formerly Globus Hystericus). Diagnosis requires a sensation of a lump or foreign body in the throat that is constant or intermittent, occurs between meals, does not interfere with swallowing, and cannot be explained by structural or reflux disease. Symptoms must be chronic (onset >= 6 months, active >= 3 months).
Usage
rome_iv_functional_globus(sensation_constant_intermittent, localized_anteriorly,
no_dysphagia_odynophagia, no_gerd_explanation,
no_structural_pathology, symptom_onset_ge_6_months,
symptoms_active_last_3_months)
Arguments
sensation_constant_intermittent |
Numeric (0 or 1). Sensation of a lump, foreign body, or throat tightness that is constant or intermittent. (1 = Yes). |
localized_anteriorly |
Numeric (0 or 1). Is the sensation localized in the anterior neck? (1 = Yes). |
no_dysphagia_odynophagia |
Numeric (0 or 1). Absence of dysphagia (difficulty swallowing) or odynophagia (painful swallowing). (1 = Yes). |
no_gerd_explanation |
Numeric (0 or 1). Symptoms are NOT exclusively occurring during episodes of heartburn or regurgitation, and GERD is excluded as the cause. (1 = Yes). |
no_structural_pathology |
Numeric (0 or 1). Absence of structural pathology (e.g., mass, inflammation) on appropriate evaluation (e.g., EGD, barium swallow). (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least 6 months prior to diagnosis? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Functional Globus" or "Criteria Not Met". |
References
Aben-Fawaz H, Kahrilas PJ, Chen J. Esophageal disorders. Gastroenterology. 2016;150:1367-1379. doi:10.1053/j.gastro.2016.02.002
Examples
# Example 1: Diagnosis Met
# Lump sensation (1), Anterior (1), No dysphagia (1), No GERD (1), No pathology (1), Chronic
rome_iv_functional_globus(1, 1, 1, 1, 1, 1, 1)
# Example 2: Not Met (Has dysphagia)
# Lump sensation (1), Anterior (1), Dysphagia present (0)
rome_iv_functional_globus(1, 1, 0, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Functional Heartburn
Description
Evaluates the **Rome IV criteria** for diagnosing **Functional Heartburn**. This is a functional esophageal disorder defined by retrosternal burning pain in the absence of structural, motor, or reflux disease that explains the symptoms. The defining features are refractory symptoms and the lack of a causal link to acid reflux.
Usage
rome_iv_functional_heartburn(burning_retrosternal_pain, no_symptom_relief_ppi,
no_erosive_esophagitis, no_gerd_explanation,
no_major_motility_disorder, symptom_onset_ge_6_months,
symptoms_active_last_3_months)
Arguments
burning_retrosternal_pain |
Numeric (0 or 1). Presence of burning retrosternal pain or discomfort. (1 = Yes). |
no_symptom_relief_ppi |
Numeric (0 or 1). Symptoms are **refractory** to optimal antisecretory therapy (e.g., PPIs). (1 = Yes). |
no_erosive_esophagitis |
Numeric (0 or 1). Absence of erosive esophagitis on Esophagogastroduodenoscopy (EGD). (1 = Yes). |
no_gerd_explanation |
Numeric (0 or 1). Absence of evidence that gastroesophageal reflux (GERD) is the cause of the symptom (e.g., negative symptom association probability/index and normal acid exposure time on reflux monitoring). (1 = Yes). |
no_major_motility_disorder |
Numeric (0 or 1). Absence of major esophageal motor disorders (e.g., achalasia) on high-resolution manometry. (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last **3 months**? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Functional Heartburn" or "Criteria Not Met". |
References
Aben-Fawaz H, Kahrilas PJ, Chen J. Esophageal disorders. Gastroenterology. 2016;150:1367-1379. doi:10.1053/j.gastro.2016.02.002
Examples
# Example 1: Diagnosis Met
# Burning pain (1), PPI failure (1), No esophagitis (1),
#Normal reflux study (1), No motility issue (1), Chronic
rome_iv_functional_heartburn(1, 1, 1, 1, 1, 1, 1)
# Example 2: Not Met (Pathological Reflux Present)
# Reflux study shows pathological acid exposure time (0 for no_gerd_explanation)
rome_iv_functional_heartburn(1, 1, 1, 0, 1, 1, 1)
Rome IV Diagnostic Criteria for Functional Pancreatic Sphincter of Oddi Disorder (SOD)
Description
Evaluates the Rome IV diagnostic criteria for Functional Pancreatic Sphincter of Oddi Disorder. Diagnosis requires recurrent, episodic pain of presumed pancreatic origin, absence of other pathology (structural, metabolic, imaging), and elevated sphincter of Oddi basal pressure documented by manometry. This disorder is characterized by presumed intermittent obstruction to pancreatic fluid outflow.
Usage
rome_iv_functional_pancreatic_sod(biliary_pain,
normal_enzymes, normal_imaging,
manometry_high, not_explained_by_other_condition,
symptom_onset_ge_6_months, symptoms_active_last_3_months)
Arguments
biliary_pain |
Numeric (0 or 1). Presence of recurrent, episodic pain of presumed pancreatic origin (consistent with recurrent pancreatitis). (1 = Yes). |
normal_enzymes |
Numeric (0 or 1). Documentation of normal pancreatic enzymes (amylase/lipase) *between* pain episodes. (1 = Yes). |
normal_imaging |
Numeric (0 or 1). Documentation of no pancreatic structural pathology (e.g., mass, chronic pancreatitis changes) on imaging (e.g., EUS, CT, or MRCP). (1 = Yes). |
manometry_high |
Numeric (0 or 1). Elevated sphincter of Oddi basal pressure documented by manometry (a pressure >= 40 mmHg is diagnostic). (1 = Yes). |
not_explained_by_other_condition |
Numeric (0 or 1). Are symptoms NOT fully explained by another medical condition? (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least 6 months prior to diagnosis? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Functional Pancreatic Sphincter of Oddi Disorder (SOD)" or "Criteria Not Met". |
References
Corazziari E, Shaffer EA, Hogan WJ, et al. Functional Disorders of the Gallbladder and Sphincter of Oddi. Gastroenterology. 2016;150:1443-1455. doi:10.1053/j.gastro.2016.02.044
Examples
# Example 1: Diagnosis Met
# All exclusion criteria and symptom characteristics are met and manometry is positive
rome_iv_functional_pancreatic_sod(1, 1, 1, 1, 1, 1, 1)
# Example 2: Not Met (Manometry Negative/Normal)
# All clinical/imaging criteria met, but manometry is normal (0)
rome_iv_functional_pancreatic_sod(1, 1, 1, 0, 1, 1, 1)
Rome IV Diagnostic Criteria for Irritable Bowel Syndrome (IBS)
Description
Evaluates the **Rome IV criteria** for diagnosing Irritable Bowel Syndrome (IBS) in adults. Diagnosis requires recurrent abdominal pain on average at least **1 day per week** in the last 3 months, associated with two or more of the following: 1) related to defecation, 2) associated with a change in stool frequency, and 3) associated with a change in stool form/appearance
[Image of bristol stool scale chart] . Symptoms must have started at least 6 months ago.
Usage
rome_iv_ibs_criteria(pain_frequency_days_month, related_to_defecation,
change_stool_frequency, change_stool_form,
organic_causes_excluded)
Arguments
pain_frequency_days_month |
Numeric. Abdominal pain frequency in **days per month** (must be >= 4 days/month or approximately 1 day/week). |
related_to_defecation |
Numeric (0 or 1). Is the pain **related to defecation**? (1 = Yes). |
change_stool_frequency |
Numeric (0 or 1). Is the pain associated with a **change in stool frequency**? (1 = Yes). |
change_stool_form |
Numeric (0 or 1). Is the pain associated with a **change in stool form** (appearance)? (1 = Yes). |
organic_causes_excluded |
Numeric (0 or 1). Have **organic, systemic, or metabolic diseases** been excluded? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Meets Criteria for Irritable Bowel Syndrome (IBS)" or "Criteria Not Met". |
IBS_Features_Count |
The number of positive associated features (max 3). |
References
Lacy BE, Mearin F, Chang L, et al. Bowel Disorders. Gastroenterology. 2016;150:1393-1407. doi:10.1053/j.gastro.2016.02.031
Examples
# Example 1: Diagnosis Met
# Pain 5 days/mo, related to defecation, change in form. Organic disease ruled out.
# Result: Meets Criteria (2 of 3 features)
rome_iv_ibs_criteria(5, 1, 0, 1, 1)
# Example 2: Not Met (Insufficient frequency)
# Pain 1 day/mo, related to defecation, change in form.
rome_iv_ibs_criteria(1, 1, 0, 1, 1)
Rome IV Diagnostic Criteria for Infant Dyschezia
Description
Evaluates the **Rome IV criteria** for diagnosing **Infant Dyschezia**, a common functional gastrointestinal disorder of infancy. The condition is characterized by straining and crying for at least 10 minutes prior to the successful passage of soft stool, occurring in infants less than 9 months old.
Usage
rome_iv_infant_dyschezia(age_lt_9mo, duration_ge_10min, crying_straining,
eventual_successful_stool, no_other_illness)
Arguments
age_lt_9mo |
Numeric (0 or 1). Is the infant under **9 months of age**? (1 = Yes). This is a required criterion. |
duration_ge_10min |
Numeric (0 or 1). Does the infant strain and cry for at least **10 minutes** prior to stool passage? (1 = Yes). |
crying_straining |
Numeric (0 or 1). Is the primary presentation **crying and straining**? (1 = Yes). |
eventual_successful_stool |
Numeric (0 or 1). Does the straining resolve with the passage of **soft stool** (i.e., not hard stool)? (1 = Yes). |
no_other_illness |
Numeric (0 or 1). Is there an **absence of other illness** or organic condition to explain the symptoms? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Infant Dyschezia" or "Criteria Not Met". |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Diagnosis Met
# Age 6mo, Cries >10min, Straining, Soft stool follows, No other illness
rome_iv_infant_dyschezia(1, 1, 1, 1, 1)
# Example 2: Not Met (Hard Stool passed - likely Constipation)
# Age 4mo, Cries >10min, Straining, Hard stool passed (0 for successful soft stool)
rome_iv_infant_dyschezia(1, 1, 1, 0, 1)
Rome IV Diagnostic Criteria for Infant Functional Constipation
Description
Evaluates the Rome IV criteria for diagnosing **Functional Constipation** in infants (from birth to 4 years of age). Diagnosis requires at least **two** of the five listed symptoms for at least 1 month, and the symptoms cannot be explained by another medical condition.
Usage
rome_iv_infant_functional_constipation(stool_frequency_lt_3_week, hard_lumpy_stool,
straining, large_diameter_stool,
rectal_fecal_mass, no_other_cause)
Arguments
stool_frequency_lt_3_week |
Numeric (0 or 1). Less than **three bowel movements** per week. (1 = Yes). |
hard_lumpy_stool |
Numeric (0 or 1). History of passing **hard or lumpy stools** (Bristol Stool Form Scale 1-2). (1 = Yes). |
straining |
Numeric (0 or 1). History of excessive **straining** or holding back stools. (1 = Yes). |
large_diameter_stool |
Numeric (0 or 1). History of passing **large diameter stools**. (1 = Yes). |
rectal_fecal_mass |
Numeric (0 or 1). Presence of a **large fecal mass** in the rectum. (1 = Yes). |
no_other_cause |
Numeric (0 or 1). Have symptoms been active for at least 1 month and are NOT fully explained by another medical condition? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Infant Functional Constipation" or "Criteria Not Met". |
Positive_Criteria_Count |
The number of positive criteria out of the five specified symptoms. |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Diagnosis Met
# 2 stools/week (1), Hard stools (1), Straining (1), No other features, No other cause
# Score = 3 (Meets criteria for 2 or more)
rome_iv_infant_functional_constipation(1, 1, 1, 0, 0, 1)
# Example 2: Not Met (Insufficient criteria)
# 4 stools/week (0), Hard stools (1), Straining (0)
# Score = 1 (Does not meet required 2 criteria)
rome_iv_infant_functional_constipation(0, 1, 0, 0, 0, 1)
Rome IV Diagnostic Criteria for Infant Functional Diarrhea
Description
Evaluates the **Rome IV criteria** for diagnosing **Infant Functional Diarrhea** (also known as toddler's diarrhea). This diagnosis is characterized by chronic, painless, loose or watery stools without evidence of growth failure or other illness, occurring in children typically between 6 and 36 months of age.
Usage
rome_iv_infant_functional_diarrhea(age_lt_36mo, three_or_more_stools_daily,
loose_watery_stool, symptom_onset_ge_4_weeks,
no_failure_to_thrive, no_illness_explanation)
Arguments
age_lt_36mo |
Numeric (0 or 1). Is the child between 6 and **36 months of age**? (1 = Yes). |
three_or_more_stools_daily |
Numeric (0 or 1). Does the child pass at least **three stools daily**? (1 = Yes). |
loose_watery_stool |
Numeric (0 or 1). Are the stools **loose or watery** (Bristol Stool Form Scale 6 or 7) [Image of bristol stool scale chart] ? (1 = Yes). |
symptom_onset_ge_4_weeks |
Numeric (0 or 1). Have symptoms been present for at least **4 weeks**? (1 = Yes). |
no_failure_to_thrive |
Numeric (0 or 1). Is there **no** evidence of **failure to thrive** (e.g., poor weight gain)? (1 = Yes). This is a required exclusion. |
no_illness_explanation |
Numeric (0 or 1). Is there **no** other organic illness or explanation for the diarrhea? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Infant Functional Diarrhea" or "Criteria Not Met". |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Diagnosis Met (Toddler's Diarrhea)
# Age 24mo, 4 stools/day, Loose stools, Duration 6 weeks, Normal growth, No other cause
rome_iv_infant_functional_diarrhea(1, 1, 1, 1, 1, 1)
# Example 2: Not Met (Failure to Thrive)
# All criteria met, but child is failing to thrive (0 for no_failure_to_thrive)
rome_iv_infant_functional_diarrhea(1, 1, 1, 1, 0, 1)
Rome IV Diagnostic Criteria for Infant Regurgitation
Description
Evaluates the **Rome IV criteria** for diagnosing **Infant Regurgitation** (Gastroesophageal Reflux, or "Spitting Up"). This is a functional disorder common in healthy infants, characterized by frequent episodes of regurgitation that are not associated with pain, aspiration, or failure to thrive.
Usage
rome_iv_infant_regurgitation(age_lt_12mo, regurgitation_ge_2_day,
no_retching_hematemesis_etc, other_illness_excluded,
symptom_onset_ge_3_weeks, symptoms_active_last_2_weeks)
Arguments
age_lt_12mo |
Numeric (0 or 1). Is the infant between 3 weeks and **12 months of age**? (1 = Yes). |
regurgitation_ge_2_day |
Numeric (0 or 1). Does the infant regurgitate **two or more times per day**? (1 = Yes). |
no_retching_hematemesis_etc |
Numeric (0 or 1). Is there **NO** evidence of retching, hematemesis, aspiration, apnea, failure to thrive, or difficult swallowing? (1 = Yes). This excludes Gastroesophageal Reflux Disease (GERD). |
other_illness_excluded |
Numeric (0 or 1). Is there **NO** other organic illness or explanation for the symptoms? (1 = Yes). |
symptom_onset_ge_3_weeks |
Numeric (0 or 1). Did symptoms onset at least **3 weeks ago**? (1 = Yes). |
symptoms_active_last_2_weeks |
Numeric (0 or 1). Have symptoms been active for the last **2 weeks**? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Infant Regurgitation" or "Criteria Not Met". |
References
Hyams JS, Di Lorenzo C, Saps M, et al. Functional Disorders: Children and Adolescents. Gastroenterology. 2016;150:1456-1468. doi:10.1053/j.gastro.2016.02.015
Examples
# Example 1: Diagnosis Met (Physiological Reflux)
# Age 6mo, Regurgitates 3x/day, No choking/poor growth, Chronic duration
rome_iv_infant_regurgitation(1, 1, 1, 1, 1, 1)
# Example 2: Not Met (Alarm Symptoms Present - Possible GERD)
# Regurgitates frequently, but is also having difficulty
#swallowing (0 for no_retching_hematemesis_etc)
rome_iv_infant_regurgitation(1, 1, 0, 1, 1, 1)
Rome IV Diagnostic Criteria for Narcotic Bowel Syndrome (NBS)
Description
Evaluates the Rome IV criteria for diagnosing Narcotic Bowel Syndrome (NBS) in patients using chronic opioid therapy. NBS is characterized by chronic, worsening, or unremitting abdominal pain associated with escalating opioid doses, distinct from simple Opioid-Induced Constipation (OIC).
Usage
rome_iv_narcotic_bowel_syndrome(chronic_pain_on_opioids,
pain_worsens_with_dose_escalation,
other_fgid_excluded, symptom_onset_ge_6mo,
symptoms_active_last_3mo)
Arguments
chronic_pain_on_opioids |
Numeric (0 or 1). Chronic or recurrent abdominal pain is present and has worsened or become unremitting during continued opioid therapy. (1 = Yes). |
pain_worsens_with_dose_escalation |
Numeric (0 or 1). Pain continues or worsens despite increasing opioid dosage. (1 = Yes). |
other_fgid_excluded |
Numeric (0 or 1). Are other functional gastrointestinal disorders (FGIDs) adequately excluded? (1 = Yes). |
symptom_onset_ge_6mo |
Numeric (0 or 1). Did symptom onset occur at least 6 months prior to diagnosis? (1 = Yes). |
symptoms_active_last_3mo |
Numeric (0 or 1). Have symptoms been active for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Narcotic Bowel Syndrome (NBS)" or "Criteria Not Met". |
References
Sikandar A, Kazi U, Khawaja MA. Narcotic Bowel Syndrome: A New Entity in Gastroenterology. J Clin Med Res. 2017;9(3):195-200. doi:10.14740/jocmr2880w
Examples
# Example 1: Diagnosis Met
# Chronic pain, pain worsens, other FGID excluded, chronic duration met
rome_iv_narcotic_bowel_syndrome(1, 1, 1, 1, 1)
# Example 2: Not Met (Pain does not worsen)
# Chronic pain, but pain is stable (0 for pain_worsens_with_dose_escalation)
rome_iv_narcotic_bowel_syndrome(1, 0, 1, 1, 1)
Rome IV Diagnostic Criteria for Opioid-Induced Constipation (OIC)
Description
Evaluates the Rome IV criteria for diagnosing Opioid-Induced Constipation (OIC) in adults. Diagnosis requires chronic opioid use, new or worsened constipation symptoms (meeting functional constipation criteria) following the initiation of opioids, and the absence of sufficient criteria for Irritable Bowel Syndrome (IBS).
Usage
rome_iv_opioid_induced_constipation(opioid_use_ge_3mo, symptom_onset_after_opioid,
straining_ge_25_percent,
lumpy_hard_stool_ge_25_percent,
sensation_incomplete_evacuation_ge_25_percent,
sensation_anorectal_blockage_ge_25_percent,
manual_maneuver_ge_25_percent, lt_3_sbm_per_week,
insufficient_criteria_for_ibs)
Arguments
opioid_use_ge_3mo |
Numeric (0 or 1). Chronic opioid use (at least 3 months). (1 = Yes). |
symptom_onset_after_opioid |
Numeric (0 or 1). New or worsening symptoms of constipation or onset after initiating opioids. (1 = Yes). |
straining_ge_25_percent |
Numeric (0 or 1). Straining during at least 25% of defecations. (1 = Yes). |
lumpy_hard_stool_ge_25_percent |
Numeric (0 or 1). Lumpy or hard stools (BSFS 1 or 2) in at least 25% of defecations [Image of bristol stool scale chart] . (1 = Yes). |
sensation_incomplete_evacuation_ge_25_percent |
Numeric (0 or 1). Sensation of incomplete evacuation in at least 25% of defecations. (1 = Yes). |
sensation_anorectal_blockage_ge_25_percent |
Numeric (0 or 1). Sensation of anorectal obstruction/blockage in at least 25% of defecations. (1 = Yes). |
manual_maneuver_ge_25_percent |
Numeric (0 or 1). Use of manual maneuvers to facilitate at least 25% of defecations. (1 = Yes). |
lt_3_sbm_per_week |
Numeric (0 or 1). Less than 3 spontaneous bowel movements (SBM) per week. (1 = Yes). |
insufficient_criteria_for_ibs |
Numeric (0 or 1). Do criteria for Irritable Bowel Syndrome (IBS) fail to be met? (1 = Yes). This is a required exclusion. |
Value
A list containing:
Diagnosis |
"Criteria Met for Opioid-Induced Constipation (OIC)" or "Criteria Not Met". |
Constipation_Criteria_Count |
The number of positive constipation symptoms (Q3-Q8). |
References
Lacy BE, Mearin F, Chang L, et al. Bowel Disorders. Gastroenterology. 2016;150:1393-1407. doi:10.1053/j.gastro.2016.02.031
Examples
# Example 1: Diagnosis Met
# Opioid use (1), Symptoms worsened (1),
#Three constipation criteria met (e.g. straining, hard stool, lt 3 SBM)
rome_iv_opioid_induced_constipation(1, 1, 1, 1, 0, 0, 0, 1, 1)
# Example 2: Not Met (Insufficient Constipation Symptoms)
# Only one symptom met (straining).
rome_iv_opioid_induced_constipation(1, 1, 1, 0, 0, 0, 0, 0, 1)
Rome IV Diagnostic Criteria for Proctalgia Fugax
Description
Evaluates the Rome IV criteria for diagnosing Proctalgia Fugax, a functional anorectal pain disorder characterized by recurrent, short-lived episodes of severe pain in the rectum.
Usage
rome_iv_proctalgia_fugax(recurrent_severe_pain, duration_lt_30min,
frequency_lt_5_year, organic_causes_excluded,
symptom_onset_ge_6mo, symptoms_active_3mo)
Arguments
recurrent_severe_pain |
Numeric (0 or 1). Presence of recurrent episodes of severe pain localized to the rectum. (1 = Yes). |
duration_lt_30min |
Numeric (0 or 1). Do episodes last seconds to minutes (less than 30 minutes)? (1 = Yes). |
frequency_lt_5_year |
Numeric (0 or 1). Are episodes infrequent (less than 5 times per year)? (1 = Yes). |
organic_causes_excluded |
Numeric (0 or 1). Are symptoms NOT better explained by structural/organic pathology (e.g., hemorrhoids, IBD)? (1 = Yes). |
symptom_onset_ge_6mo |
Numeric (0 or 1). Did symptom onset occur at least 6 months prior to diagnosis? (1 = Yes). |
symptoms_active_3mo |
Numeric (0 or 1). Have symptoms been active for the last 3 months? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Proctalgia Fugax" or "Criteria Not Met". |
References
Rao SS, Bharucha AE, Chiarioni G, et al. Anorectal Disorders. Gastroenterology. 2016;150:1430-1442. doi:10.1053/j.gastro.2016.02.009
Examples
# Example 1: Diagnosis Met
# Recurrent pain (1), Duration minutes (1),
#Frequency 3/year (1), Organic excluded (1), Chronic met (1,1)
rome_iv_proctalgia_fugax(1, 1, 1, 1, 1, 1)
# Example 2: Not Met (Frequency too high)
# Recurrent pain, Duration minutes, Frequency 6/year (0 for < 5)
rome_iv_proctalgia_fugax(1, 1, 0, 1, 1, 1)
Rome IV Diagnostic Criteria for Reflux Hypersensitivity
Description
Evaluates the **Rome IV criteria** for diagnosing **Reflux Hypersensitivity**. This disorder is characterized by retrosternal symptoms (heartburn or chest pain) caused by physiological amounts of reflux (non-acid or acid) in patients who are refractory to proton pump inhibitor (PPI) therapy and lack endoscopic evidence of erosive esophagitis.
Usage
rome_iv_reflux_hypersensitivity(retrosternal_symptoms_bothersome, normal_egd,
reflux_excluded, symptoms_refractory_to_ppis,
symptoms_triggered_by_reflux,
symptoms_not_associated_with_major_motility,
symptom_onset_ge_6_months,
symptoms_active_last_3_months)
Arguments
retrosternal_symptoms_bothersome |
Numeric (0 or 1). Presence of bothersome retrosternal symptoms (heartburn or chest pain). (1 = Yes). |
normal_egd |
Numeric (0 or 1). Normal Esophagogastroduodenoscopy (EGD) (i.e., no erosive esophagitis). (1 = Yes). |
reflux_excluded |
Numeric (0 or 1). Absence of pathological reflux (negative symptom association probability or acid exposure time). (1 = Yes). |
symptoms_refractory_to_ppis |
Numeric (0 or 1). Refractory to optimized antisecretory therapy (e.g., maximal PPIs). (1 = Yes). |
symptoms_triggered_by_reflux |
Numeric (0 or 1). Symptoms are triggered by reflux events (positive symptom association probability or symptom index on reflux monitoring). (1 = Yes). |
symptoms_not_associated_with_major_motility |
Numeric (0 or 1). Absence of major esophageal motor disorders (e.g., achalasia, spasm). (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last **3 months**? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Reflux Hypersensitivity" or "Criteria Not Met". |
References
Aben-Fawaz H, Kahrilas PJ, Chen J. Esophageal disorders. Gastroenterology. 2016;150:1367-1379. doi:10.1053/j.gastro.2016.02.002
Examples
# Example 1: Diagnosis Met
# All criteria met (bothersome symptoms, normal EGD, triggered by normal reflux,
#PPI refractory, no motility issues, chronic duration)
rome_iv_reflux_hypersensitivity(1, 1, 1, 1, 1, 1, 1, 1)
# Example 2: Not Met (Pathological Reflux Present)
# Reflux monitoring shows excessive acid exposure time (0 for reflux_excluded)
rome_iv_reflux_hypersensitivity(1, 1, 0, 1, 1, 1, 1, 1)
Rome IV Diagnostic Criteria for Rumination Syndrome
Description
Evaluates the **Rome IV criteria** for diagnosing **Rumination Syndrome** (in adults and adolescents). Diagnosis requires repeated regurgitation and re-chewing or expulsion of food starting soon after ingestion, **not** during sleep, **not** preceded by retching, and **not** explained by another medical condition or eating disorder. Symptoms must have started at least 6 months prior and been active for the last 3 months.
Usage
rome_iv_rumination_syndrome(symptom_duration_months, repeated_regurgitation,
starts_soon_after_meal, does_not_occur_during_sleep,
no_retching_preceding, not_explained_by_medical_condition)
Arguments
symptom_duration_months |
Numeric. Duration of symptoms in months (Must be **>= 2 months**). |
repeated_regurgitation |
Numeric (0 or 1). Presence of repeated regurgitation and re-chewing or expulsion of food. (1 = Yes). |
starts_soon_after_meal |
Numeric (0 or 1). Does the regurgitation begin **soon after ingestion** of a meal? (1 = Yes). |
does_not_occur_during_sleep |
Numeric (0 or 1). Does the regurgitation **NOT occur during sleep**? (1 = Yes, it does not occur during sleep). |
no_retching_preceding |
Numeric (0 or 1). Is the regurgitation **NOT preceded by retching**? (1 = Yes, no preceding retching). |
not_explained_by_medical_condition |
Numeric (0 or 1). Are symptoms **NOT** better explained by another medical condition (e.g., GERD, eosinophilic esophagitis) or eating disorder? (1 = Yes, not explained by others). |
Value
A list containing:
Diagnosis |
"Criteria Met for Rumination Syndrome" or "Criteria Not Met". |
References
Stanghellini V, Chan FK, Hasler WL, et al. Gastroduodenal Disorders. Gastroenterology. 2016;150:1380-1392. doi:10.1053/j.gastro.2016.02.011
Examples
# Example 1: Diagnosis Met
# 3 months duration, Regurgitation, After meal, Not sleep, No retching, No other cause
rome_iv_rumination_syndrome(3, 1, 1, 1, 1, 1)
# Example 2: Not Met (Vomiting is preceded by retching)
# 3 months duration, Retching precedes (0 for no_retching)
rome_iv_rumination_syndrome(3, 1, 1, 1, 0, 1)
Rome IV Diagnostic Criteria for Unspecified Functional Bowel Disorder
Description
Evaluates the **Rome IV criteria** for diagnosing **Unspecified Functional Bowel Disorder**. This is a residual category diagnosis applied when patients have chronic, recurrent abdominal symptoms but do not meet the full diagnostic criteria for Irritable Bowel Syndrome (IBS), Functional Constipation, Functional Diarrhea, or Functional Abdominal Bloating/Distension.
Usage
rome_iv_unspecified_functional_bowel_disorder(abdominal_symptoms_ge_1_day_week,
other_fgid_excluded,
symptom_onset_ge_6_months,
symptoms_active_last_3_months)
Arguments
abdominal_symptoms_ge_1_day_week |
Numeric (0 or 1). Presence of recurrent abdominal symptoms (e.g., pain, discomfort, bloating, distension) occurring on average at least **1 day per week**. (1 = Yes). |
other_fgid_excluded |
Numeric (0 or 1). Does the patient **NOT** meet the full diagnostic criteria for IBS, functional constipation, functional diarrhea, or functional bloating? (1 = Yes). |
symptom_onset_ge_6_months |
Numeric (0 or 1). Did symptom onset occur at least **6 months ago**? (1 = Yes). |
symptoms_active_last_3_months |
Numeric (0 or 1). Have symptoms been active for the last **3 months**? (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Unspecified Functional Bowel Disorder" or "Criteria Not Met". |
References
Lacy BE, Mearin F, Chang L, et al. Bowel Disorders. Gastroenterology. 2016;150:1393-1407. doi:10.1053/j.gastro.2016.02.031
Examples
# Example 1: Diagnosis Met
# Recurrent symptoms >1/wk, Does not meet full criteria for IBS/Constipation, Chronic duration met
rome_iv_unspecified_functional_bowel_disorder(1, 1, 1, 1)
# Example 2: Not Met (Meets IBS criteria)
# Recurrent symptoms >1/wk, Meets full criteria for IBS (0 for other_fgid_excluded)
rome_iv_unspecified_functional_bowel_disorder(1, 0, 1, 1)
Risk of Paradoxical Embolism (RoPE) Score
Description
Calculates the RoPE Score to estimate the probability that a cryptogenic stroke is related to a Patent Foramen Ovale (PFO). The score ranges from 0 to 10, with higher scores indicating a higher PFO-attributable fraction (i.e., it is more likely the PFO caused the stroke rather than being an incidental finding).
Usage
rope_risk_score(age, history_hypertension, history_diabetes,
history_stroke_tia, current_smoker, cortical_infarct)
Arguments
age |
Numeric. Patient age in years. 18-29: +5 pts 30-39: +4 pts 40-49: +3 pts 50-59: +2 pts 60-69: +1 pt >=70: 0 pts |
history_hypertension |
Numeric (0 or 1). History of hypertension. (0 = No [+1 pt], 1 = Yes [0 pts]). |
history_diabetes |
Numeric (0 or 1). History of diabetes. (0 = No [+1 pt], 1 = Yes [0 pts]). |
history_stroke_tia |
Numeric (0 or 1). History of prior stroke or TIA. (0 = No [+1 pt], 1 = Yes [0 pts]). |
current_smoker |
Numeric (0 or 1). Current smoker. (0 = No [+1 pt], 1 = Yes [0 pts]). |
cortical_infarct |
Numeric (0 or 1). Cortical infarct present on imaging. (1 = Yes [+1 pt], 0 = No [0 pts]). |
Value
A list containing:
RoPE_Score |
The calculated total score (Range 0-10). |
PFO_Attributable_Fraction |
The estimated probability that the stroke is PFO-related. |
Stroke_Recurrence_Risk |
General risk category for 2-year stroke recurrence. |
References
Kent DM, Ruthazer R, Weimar C, et al. An index to identify stroke-related vs incidental patent foramen ovale in cryptogenic stroke. Neurology. 2013;81(7):619-625. doi:10.1212/WNL.0b013e3182a08d59
Examples
# Example 1: High Probability of PFO-related stroke
# 35yo, No HTN, No DM, No Prior Stroke, Non-smoker, Cortical Infarct
# Score: 4(age) + 1(HTN) + 1(DM) + 1(Hx) + 1(Smoke) + 1(Cortical) = 9
rope_risk_score(35, 0, 0, 0, 0, 1)
# Example 2: Low Probability (Incidental PFO likely)
# 65yo, HTN, Smoker, Prior Stroke
# Score: 1(age) + 0 + 1(DM) + 0 + 0 + 0(Subcortical) = 2
rope_risk_score(65, 1, 0, 1, 1, 0)
ROSE Risk Stratification of Syncope
Description
Applies the ROSE (Risk Stratification of Syncope in the Emergency Department) rule to predict serious outcomes at 1 month in patients presenting with syncope. The rule uses the mnemonic **BRACES** to identify high-risk features (BNP, Bradycardia, Rectal exam/FOBT, Anemia, Chest pain, ECG Q-waves, Saturation). The presence of any single risk factor classifies the patient as High Risk.
Usage
rose_syncope_score(bnp_level, heart_rate, positive_fecal_occult_blood,
hemoglobin, chest_pain, ecg_q_waves, oxygen_saturation)
Arguments
bnp_level |
Numeric. B-Type Natriuretic Peptide level in pg/mL. (>= 300 indicates high risk). |
heart_rate |
Numeric. Heart rate in beats per minute. (<= 50 indicates high risk). |
positive_fecal_occult_blood |
Numeric (0 or 1). Positive rectal exam for fecal occult blood? (1 = Yes). |
hemoglobin |
Numeric. Hemoglobin level in g/dL. (<= 9.0 g/dL indicates high risk). |
chest_pain |
Numeric (0 or 1). Did the patient experience chest pain associated with the syncope? (1 = Yes). |
ecg_q_waves |
Numeric (0 or 1). Are pathological Q waves present on ECG (excluding lead III)? (1 = Yes). |
oxygen_saturation |
Numeric. Oxygen saturation on room air percentage. (<= 94% indicates high risk). |
Value
A list containing:
Risk_Category |
"Low Risk" (0 factors) or "High Risk" (>= 1 factor). |
Recommendation |
Clinical guidance regarding discharge vs. admission. |
Risk_Factors_Present |
A list of the specific criteria met. |
References
Reed MJ, Newby DE, Coull AJ, et al. The ROSE (Risk Stratification of Syncope in the Emergency Department) study. J Am Coll Cardiol. 2010;55(8):713-721. doi:10.1016/j.jacc.2009.09.049
Examples
# Example 1: High Risk
# BNP 400, HR 45, SpO2 92
# Result: High Risk (BNP, Bradycardia, Saturation)
rose_syncope_score(400, 45, 0, 12.0, 0, 0, 92)
# Example 2: Low Risk
# Normal labs and vitals
# Result: Low Risk
rose_syncope_score(50, 70, 0, 14.0, 0, 0, 98)
Recognition of Stroke in the Emergency Room (ROSIER) Scale
Description
Calculates the ROSIER score to help emergency department staff differentiate between acute stroke and stroke mimics. The score assigns points for specific neurological deficits and subtracts points for loss of consciousness or seizure activity, which are more common in mimics.
Usage
rosier_stroke_scale(loss_of_consciousness, seizure_activity,
asymmetric_facial_weakness, asymmetric_arm_weakness,
asymmetric_leg_weakness, speech_disturbance,
visual_field_defect)
Arguments
loss_of_consciousness |
Numeric (0 or 1). Has there been loss of consciousness or syncope? (1 = Yes, -1 point). |
seizure_activity |
Numeric (0 or 1). Has there been seizure activity? (1 = Yes, -1 point). |
asymmetric_facial_weakness |
Numeric (0 or 1). Is there new acute asymmetric facial weakness? (1 = Yes, +1 point). |
asymmetric_arm_weakness |
Numeric (0 or 1). Is there new acute asymmetric arm weakness? (1 = Yes, +1 point). |
asymmetric_leg_weakness |
Numeric (0 or 1). Is there new acute asymmetric leg weakness? (1 = Yes, +1 point). |
speech_disturbance |
Numeric (0 or 1). Is there speech disturbance? (1 = Yes, +1 point). |
visual_field_defect |
Numeric (0 or 1). Is there a visual field defect? (1 = Yes, +1 point). |
Value
A list containing:
ROSIER_Score |
The calculated total score (Range -2 to +5). |
Likelihood |
Interpretation (Stroke Likely > 0, Unlikely <= 0). |
Test_Characteristics |
Sensitivity and Specificity for the >0 cutoff. |
References
Nor AM, Davis J, Sen B, et al. The Recognition of Stroke in the Emergency Room (ROSIER) scale: development and validation of a stroke recognition instrument. Lancet Neurol. 2005;4(11):727-734. doi:10.1016/S1474-4422(05)70201-5
Examples
# Example 1: Stroke Likely
# Face weakness (+1), Arm weakness (+1), Speech disturbance (+1)
# Score = 3
rosier_stroke_scale(0, 0, 1, 1, 0, 1, 0)
# Example 2: Stroke Unlikely (Mimic)
# Seizure (-1), LOC (-1), Arm weakness (+1)
# Score = -1
rosier_stroke_scale(1, 1, 0, 1, 0, 0, 0)
Roth Score for Hypoxia Screening
Description
Calculates the Roth Score risk stratification for hypoxia. This simple bedside test involves the patient taking a deep breath and counting out loud from 1 to 30 as fast as possible. The highest number reached (Max Count) correlates with pulse oximetry (SpO2) levels. It is often used as a screening tool for telemedicine or when pulse oximetry is unavailable.
Usage
roth_hypoxia_score(max_count_reached, duration_seconds)
Arguments
max_count_reached |
Numeric. The highest number the patient reached in a single breath counting out loud as fast as possible. |
duration_seconds |
Numeric. The total time in seconds elapsed during the count. (Used primarily for clinical context/verification of effort). |
Value
A list containing:
Max_Count |
The input count. |
Risk_Category |
Risk classification (High, Intermediate, Low) based on the count threshold. |
Diagnostic_Performance |
Sensitivity metrics for detecting SpO2 < 95% based on the count. |
References
Chorath K, Prine L, Ludmir J, et al. The Roth Score: A Novel Method for Assessing Hypoxia. Telemedicine and e-Health. 2021.
Examples
# Example 1: High Risk
# Patient reached 5 in 4 seconds
roth_hypoxia_score(5, 4)
# Example 2: Low Risk
# Patient reached 25 in 10 seconds
roth_hypoxia_score(25, 10)
ROX Index for Intubation Risk after HFNC
Description
Calculates the ROX Index (Respiratory rate-Oxygenation) to predict the success or failure of High-Flow Nasal Cannula (HFNC) therapy in patients with acute hypoxemic respiratory failure. The index is defined as the ratio of SpO2/FiO2 to Respiratory Rate. A lower score (< 2.85 to 4.88) indicates a higher risk of HFNC failure and the need for intubation.
Usage
rox_index_score(spo2_percent, fio2_percent, respiratory_rate)
Arguments
spo2_percent |
Numeric. Oxygen saturation percentage (0-100). |
fio2_percent |
Numeric. Fraction of Inspired Oxygen (can be entered as percent 21-100 or decimal 0.21-1.0). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. |
Value
A list containing:
ROX_Index |
The calculated index value. |
Interpretation |
Clinical interpretation based on risk thresholds (e.g., < 2.85, < 3.85, < 4.88, >= 4.88). |
References
Roca O, Messika J, Caralt B, et al. Predicting success of high-flow nasal cannula in pneumonia patients with hypoxemic respiratory failure: The utility of the ROX index. J Crit Care. 2016;35:200-205. doi:10.1016/j.jcrc.2016.05.022 Roca O, Caralt B, Messika J, et al. An Index Combining Respiratory Rate and Oxygenation to Predict Outcome of Nasal High-Flow Therapy. Am J Respir Crit Care Med. 2019;199(11):1368-1376.
Examples
# Example 1: High Risk of Failure
# SpO2 88%, FiO2 1.0 (100%), RR 35
# Ratio = 88 / 1.0 = 88. Index = 88 / 35 = 2.51
rox_index_score(88, 100, 35)
# Example 2: Success Likely
# SpO2 95%, FiO2 0.4 (40%), RR 20
# Ratio = 95 / 0.4 = 237.5. Index = 237.5 / 20 = 11.88
rox_index_score(95, 40, 20)
Rapid Shallow Breathing Index (RSBI)
Description
Calculates the Rapid Shallow Breathing Index (RSBI), a prognostic tool used to predict the success of weaning a patient from mechanical ventilation. It is defined as the ratio of respiratory frequency to tidal volume (f/Vt). Scores less than 105 breaths/min/L suggest a high likelihood of successful extubation.
Usage
rsbi_score(respiratory_rate, tidal_volume, volume_units = "L")
Arguments
respiratory_rate |
Numeric. Respiratory frequency in breaths per minute. |
tidal_volume |
Numeric. Tidal volume measured during spontaneous breathing. |
volume_units |
String. Units for tidal volume. Options: "L" (default) or "mL". |
Value
A list containing:
RSBI_Score |
The calculated index value (breaths/min/L). |
Interpretation |
Prognostic guidance based on the 105 threshold. |
References
Yang KL, Tobin MJ. A prospective study of indexes predicting the outcome of trials of weaning from mechanical ventilation. N Engl J Med. 1991;324(21):1445-1450. doi:10.1056/NEJM199105233242101
Examples
# Example 1: Success Likely
# RR 20, Vt 0.4 L (400 mL)
# RSBI = 20 / 0.4 = 50
rsbi_score(20, 0.4)
# Example 2: Failure Likely
# RR 35, Vt 300 mL (0.3 L)
# RSBI = 35 / 0.3 = 116.7
rsbi_score(35, 300, "mL")
Risk Score for Asthma Exacerbation (RSE)
Description
Calculates the Risk Score for Asthma Exacerbation (RSE) to predict the likelihood of an asthma exacerbation within the next 6 months. The score is derived from 5 clinical variables: BMI, ACQ-5 score, Post-bronchodilator FEV1, Rescue inhaler use, and GINA treatment step.
Usage
rse_asthma_score(bmi_ge_30, acq5_score, fev1_percent_predicted,
rescue_inhaler_uses_per_day, gina_step_4_or_higher)
Arguments
bmi_ge_30 |
Numeric (0 or 1). Is BMI >= 30 kg/m^2? (1 = Yes, +14 points). |
acq5_score |
Numeric. Asthma Control Questionnaire-5 (ACQ-5) Score. (<1.5: 0 pts, 1.5-2.49: +7 pts, >=2.5: +13 pts). |
fev1_percent_predicted |
Numeric. Post-bronchodilator FEV1 ( |
rescue_inhaler_uses_per_day |
Numeric. Average rescue inhaler usage per day. (<2: 0 pts, 2-3.9: +11 pts, >=4: +26 pts). |
gina_step_4_or_higher |
Numeric (0 or 1). Is the patient on GINA treatment step 4 or higher (e.g., medium/high dose ICS/LABA)? (1 = Yes, +27 points). |
Value
A list containing:
RSE_Score |
The calculated total score (Range 0-100). |
Risk_Category |
Estimated risk level for exacerbation within 6 months. |
References
Bateman ED, et al. Development and validation of a novel risk score for asthma exacerbations: The risk score for exacerbation. J Allergy Clin Immunol. 2015;135(6):1457-1464.e4. doi:10.1016/j.jaci.2014.12.1915
Examples
# Example 1: High Risk
# BMI 32 (+14), ACQ 3.0 (+13), FEV1 70% (+20), Rescue 5/day (+26), GINA 4 (+27)
# Score = 100
rse_asthma_score(1, 3.0, 70, 5, 1)
# Example 2: Low Risk
# BMI 25 (0), ACQ 0.5 (0), FEV1 95% (0), Rescue 0 (0), GINA 2 (0)
# Score = 0
rse_asthma_score(0, 0.5, 95, 0, 0)
Revised Urinary Incontinence Scale (RUIS)
Description
Calculates the Revised Urinary Incontinence Scale (RUIS) score to assess the severity of urinary incontinence. The scale consists of 5 items evaluating leakage related to activity, urgency, other causes, amount, and frequency.
Usage
ruis_score(leakage_activity, leakage_urgency, leakage_no_activity,
leakage_amount, leakage_frequency)
Arguments
leakage_activity |
Numeric (0-3). Q1: How often do you experience urine leakage related to physical activity, coughing, or sneezing? 0: Not at all 1: Slightly 2: Moderately 3: Greatly |
leakage_urgency |
Numeric (0-3). Q2: How often do you experience urine leakage related to the feeling of urgency? 0: Not at all 1: Slightly 2: Moderately 3: Greatly |
leakage_no_activity |
Numeric (0-3). Q3: How often do you experience urine leakage related to neither physical activity nor urgency? 0: Not at all 1: Slightly 2: Moderately 3: Greatly |
leakage_amount |
Numeric (0-3). Q4: How much urine do you lose each time? 0: Drops 1: Small splashes 2: More than splashes |
leakage_frequency |
Numeric (0-4). Q5: How often do you experience urine leakage? 0: Never 1: Once a month or less 2: Two or three times a month 3: Once a week 4: Every day and/or night |
Value
A list containing:
RUIS_Score |
The calculated total score (Range 0-16). |
Severity_Level |
Classification (Slight 0-3, Moderate 4-8, Severe >=9). |
References
Sansoni J, Hawthorne G, Marosszeky N, et al. Validation of the Revised Urinary Incontinence Scale (RUIS). Proc Int Continence Soc. 2010.
Examples
# Example 1: Moderate Incontinence
# Activity(2), Urgency(1), Other(0), Amount(1), Frequency(3)
# Score = 2+1+0+1+3 = 7
ruis_score(2, 1, 0, 1, 3)
# Example 2: Severe Incontinence
# Activity(3), Urgency(3), Other(1), Amount(2), Frequency(4)
# Score = 3+3+1+2+4 = 13
ruis_score(3, 3, 1, 2, 4)
Rule of 7's for Lyme Meningitis
Description
Calculates the Rule of 7's to stratify the risk of Lyme meningitis in children presenting with aseptic meningitis. A patient is classified as "Low Risk" if they meet all three criteria: Headache duration < 7 days, CSF mononuclear cells < 70%, and absence of 7th cranial nerve palsy. Failure of any criterion warrants further investigation for Lyme disease.
Usage
rule_of_7s_lyme(headache_duration_days, csf_mononuclear_percent, seventh_nerve_palsy)
Arguments
headache_duration_days |
Numeric. Duration of headache in days. |
csf_mononuclear_percent |
Numeric. Percentage of mononuclear cells in the Cerebrospinal Fluid (CSF). |
seventh_nerve_palsy |
Numeric (0 or 1). Presence of 7th cranial nerve palsy (facial palsy). (1 = Yes). |
Value
A list containing:
Risk_Classification |
"Low Risk" or "Not Low Risk". |
Management_Guidance |
Clinical suggestions based on the risk level. |
Risk_Factors_Present |
List of specific criteria that failed the low-risk check. |
References
Garro AC, Rutman M, Simonsen K, et al. Prospective validation of a clinical prediction model for Lyme meningitis in children. Pediatrics. 2009;123(5):e829-834. doi:10.1542/peds.2008-2425
Examples
# Example 1: Low Risk
# 3 days headache, 50% monos, No palsy
rule_of_7s_lyme(3, 50, 0)
# Example 2: High Risk (Failed duration and monos)
# 10 days headache, 80% monos, No palsy
rule_of_7s_lyme(10, 80, 0)
Wallace Rule of Nines for Burn Area Assessment
Description
Calculates the Total Body Surface Area (TBSA) percentage involved in burn injuries using the Wallace Rule of Nines. This estimation is crucial for determining fluid resuscitation requirements (e.g., via the Parkland Formula). The function allows inputting the percentage of each anatomical region that is affected (0-100
Usage
rule_of_nines(head_percent, left_arm_percent, right_arm_percent,
anterior_torso_percent, posterior_torso_percent,
left_leg_percent, right_leg_percent, genitalia_percent,
patient_type = "adult")
Arguments
head_percent |
Numeric (0-100). Percentage of the head/neck surface area that is burned. |
left_arm_percent |
Numeric (0-100). Percentage of the left arm surface area that is burned. |
right_arm_percent |
Numeric (0-100). Percentage of the right arm surface area that is burned. |
anterior_torso_percent |
Numeric (0-100). Percentage of the anterior torso (chest/abdomen) surface area that is burned. |
posterior_torso_percent |
Numeric (0-100). Percentage of the posterior torso (back) surface area that is burned. |
left_leg_percent |
Numeric (0-100). Percentage of the left leg surface area that is burned. |
right_leg_percent |
Numeric (0-100). Percentage of the right leg surface area that is burned. |
genitalia_percent |
Numeric (0-100). Percentage of the genital area that is burned. |
patient_type |
String. "adult" (default) or "child". Adjusts the weights (Head 9 |
Details
Adult Weights: Head (9%), Each Arm (9%), Anterior Torso (18%), Posterior Torso (18%), Each Leg (18%), Genitalia (1%). Child Weights: Head (18%), Each Arm (9%), Anterior Torso (18%), Posterior Torso (18%), Each Leg (13.5%), Genitalia (1%).
Value
A list containing:
Total_Body_Surface_Area_Burned |
The calculated total burn percentage. |
Inputs |
A summary of the extent of injury entered for each region. |
References
Wallace AB. The exposure treatment of burns. Lancet. 1951;1(6653):501-504. doi:10.1016/s0140-6736(51)91975-7
Examples
# Example 1: Adult with burns on whole left arm and half of chest
# L Arm (100% burned -> 9 TBSA), R Arm (0%), Ant Torso (50% burned -> 9 TBSA), others 0
# Total TBSA = 9 + 9 = 18%
rule_of_nines(0, 100, 0, 50, 0, 0, 0, 0, "adult")
# Example 2: Child with burns on entire head and right leg
# Head (100% -> 18 TBSA), R Leg (100% -> 13.5 TBSA)
# Total TBSA = 18 + 13.5 = 31.5%
rule_of_nines(100, 0, 0, 0, 0, 0, 100, 0, "child")
Steatosis-Associated Fibrosis Estimator (SAFE) Score
Description
Calculates the SAFE score to predict the presence of significant liver fibrosis (stage F2 or higher) in patients with Non-Alcoholic Fatty Liver Disease (NAFLD) / Metabolic Dysfunction-Associated Steatotic Liver Disease (MASLD). The score uses age, BMI, diabetes status, platelet count, AST/ALT ratio, and serum globulin.
Usage
safe_fibrosis_score(age, bmi, diabetes, platelets, alt, ast, globulin)
Arguments
age |
Numeric. Patient age in years. |
bmi |
Numeric. Body Mass Index in kg/m^2. |
diabetes |
Numeric (0 or 1). Presence of Type 2 Diabetes Mellitus. (1 = Yes). |
platelets |
Numeric. Platelet count in x10^9/L. |
alt |
Numeric. Alanine Aminotransferase level in U/L. |
ast |
Numeric. Aspartate Aminotransferase level in U/L. |
globulin |
Numeric. Serum Globulin level in g/dL. (Can be calculated as Total Protein - Albumin). |
Details
The regression formula used is:
SAFE = -4.782 + (0.037 \times Age) + (0.094 \times BMI) + (1.13 \times Diabetes) + (0.99 \times \frac{AST}{ALT}) - (0.013 \times Platelets) + (0.66 \times Globulin)
A score > 0 indicates a high risk of significant fibrosis (>= F2).
Value
A list containing:
SAFE_Score |
The calculated logit score. |
Probability |
The estimated probability of significant fibrosis. |
Interpretation |
Risk classification based on the 0 cutoff. |
References
Alkhouri N, et al. The Steatosis-Associated Fibrosis Estimator (SAFE) Score: A Novel Score to Detect Significant Fibrosis in Patients with Non-Alcoholic Fatty Liver Disease. 2018.
Examples
# Example 1: High Risk
# Age 50, BMI 35, Diabetes Yes, Plt 150, ALT 40, AST 50 (Ratio 1.25), Globulin 3.5
safe_fibrosis_score(50, 35, 1, 150, 40, 50, 3.5)
# Example 2: Low Risk
# Age 30, BMI 25, No Diabetes, Plt 250, ALT 30, AST 20 (Ratio 0.67), Globulin 2.5
safe_fibrosis_score(30, 25, 0, 250, 30, 20, 2.5)
Salivary Gland Cancer Model for Survival +/- Postoperative Radiotherapy (PORT)
Description
Provides a structure to calculate overall survival probability for patients with resected major salivary gland cancer, with or without postoperative radiotherapy (PORT). This model is based on the study by Jacobs et al. using the National Cancer Database (NCDB). It helps in decision-making regarding the benefit of PORT by stratifying survival based on clinical and pathological factors.
Usage
salivary_gland_cancer_port_survival(age_at_diagnosis, sex, charlson_deyo_score,
pathologic_t_stage, ratio_nodal_positivity,
grade, surgical_margin, primary_site,
port_received)
Arguments
age_at_diagnosis |
Numeric. Patient age in years. |
sex |
String. "Male" or "Female". |
charlson_deyo_score |
Numeric. Charlson-Deyo comorbidity score (0, 1, 2, or >=3). |
pathologic_t_stage |
Numeric. AJCC Pathologic T Stage (1, 2, 3, or 4). |
ratio_nodal_positivity |
String. Ratio of positive lymph nodes to total nodes examined. Options: "0", "0.1-10", "10.1-49.9", ">=50". |
grade |
String. Tumor grade. Options: "low", "intermediate", "high". |
surgical_margin |
String. Status of surgical margins. Options: "negative", "positive". |
primary_site |
String. Primary tumor site. Options: "parotid", "submandibular", "sublingual". |
port_received |
String. Did the patient receive Postoperative Radiotherapy? "no", "yes". |
Value
A list containing:
Note |
Information regarding the calculation logic. |
Inputs |
The validated inputs provided for the model. |
References
Jacobs CD, et al. Nomogram to Predict Survival Benefit of Postoperative Radiotherapy for Major Salivary Gland Cancers. Head Neck. 2020.
Examples
# Example: 65yo Male with T3N1 Parotid Cancer, Positive Margins
salivary_gland_cancer_port_survival(65, "male", 0, 3, "0.1-10", "high", "positive", "parotid", "no")
San Francisco Syncope Rule
Description
Calculates the San Francisco Syncope Rule result to predict the risk of serious outcomes at 7 days in patients presenting with syncope. The rule uses the CHESS mnemonic: CHF history, Hematocrit < 30, ECG abnormal, Shortness of breath, and Systolic BP < 90. Presence of any single factor classifies the patient as High Risk.
Usage
san_francisco_syncope_rule(history_chf, hematocrit, ecg_abnormal,
shortness_of_breath, systolic_bp)
Arguments
history_chf |
Numeric (0 or 1). History of Congestive Heart Failure. (1 = Yes). |
hematocrit |
Numeric. Hematocrit percentage. (< 30% is a positive predictor). |
ecg_abnormal |
Numeric (0 or 1). Abnormal ECG (e.g., non-sinus rhythm or new changes). (1 = Yes). |
shortness_of_breath |
Numeric (0 or 1). History of shortness of breath. (1 = Yes). |
systolic_bp |
Numeric. Systolic blood pressure at triage in mmHg. (< 90 mmHg is a positive predictor). |
Value
A list containing:
Risk_Classification |
"High Risk" (if any criteria met) or "Low Risk". |
Criteria_Present |
List of specific positive predictors identified. |
Test_Characteristics |
Sensitivity and Specificity metrics. |
References
Quinn J, McDermott D, Stiell I, Kohn M, Wells G. Prospective validation of the San Francisco Syncope Rule to predict patients with serious outcomes. Ann Emerg Med. 2006;47(5):448-454. doi:10.1016/j.annemergmed.2005.11.019
Examples
# Example 1: High Risk (CHF history)
# Hx CHF (1), Hct 40, Normal ECG, No SOB, SBP 120
san_francisco_syncope_rule(1, 40, 0, 0, 120)
# Example 2: Low Risk
# No Hx, Hct 42, Normal ECG, No SOB, SBP 110
san_francisco_syncope_rule(0, 42, 0, 0, 110)
# Example 3: High Risk (Low Hct and Low BP)
# No Hx, Hct 25, Normal ECG, No SOB, SBP 85
san_francisco_syncope_rule(0, 25, 0, 0, 85)
Simplified Acute Physiology Score III (SAPS 3)
Description
Calculates the SAPS 3 score and predicted hospital mortality for ICU patients. The score uses data available within 1 hour of ICU admission to assess severity of illness based on 20 variables covering patient characteristics, reasons for admission, and physiological derangement.
Usage
saps_3_score(age, admission_type, admission_source, length_of_stay_days,
anatomical_system, infection_type, gcs_score, bilirubin_mg_dl,
temperature_c, creatinine_mg_dl, heart_rate, wbc_count, ph_level,
platelet_count, systolic_bp, mechanical_ventilation, pao2_fio2_ratio,
vasoactive_drugs, comorbidities)
Arguments
age |
Numeric. Patient age in years. |
admission_type |
String. "medical", "scheduled_surgical", or "unscheduled_surgical". |
admission_source |
String. "ward", "emergency_room", "other_icu", "other_hospital", or "operating_room". |
length_of_stay_days |
Numeric. Days in hospital prior to ICU admission. |
anatomical_system |
String. Primary system involved (e.g., "cardiovascular", "digestive", "neurologic", "respiratory", "renal", "hematologic", "metabolic", "trauma", "orthopedic", "gynecology", "other"). |
infection_type |
String. "none", "respiratory", or "nosocomial". |
gcs_score |
Numeric. Lowest Glasgow Coma Scale score. |
bilirubin_mg_dl |
Numeric. Highest Total Bilirubin (mg/dL). |
temperature_c |
Numeric. Highest Body Temperature (Celsius). |
creatinine_mg_dl |
Numeric. Highest Serum Creatinine (mg/dL). |
heart_rate |
Numeric. Highest Heart Rate (bpm). |
wbc_count |
Numeric. Highest Leukocytes (x10^3/mm^3). |
ph_level |
Numeric. Lowest arterial pH. |
platelet_count |
Numeric. Lowest Platelet count (x10^3/mm^3). |
systolic_bp |
Numeric. Lowest Systolic Blood Pressure (mmHg). |
mechanical_ventilation |
Numeric (0 or 1). Is the patient mechanically ventilated? |
pao2_fio2_ratio |
Numeric. Ratio of PaO2 to FiO2 (if ventilated). |
vasoactive_drugs |
Numeric (0 or 1). Is the patient receiving vasoactive drugs? |
comorbidities |
Vector of strings. List of comorbidities: "cancer_therapy", "hematologic_cancer", "cirrhosis", "aids", "heart_failure_nyha4", "metastatic_cancer", "immunosuppression". |
Value
A list containing:
SAPS_3_Score |
The calculated SAPS 3 score. |
Predicted_Hospital_Mortality |
The estimated probability of hospital mortality percentage. |
References
Moreno RP, Metnitz PG, Almeida E, et al. SAPS 3–From evaluation of the patient to evaluation of the intensive care unit. Part 2: Development of a prognostic model for hospital mortality at ICU admission. Intensive Care Med. 2005;31(10):1345-1355.
Examples
saps_3_score(
age = 65,
admission_type = "medical",
admission_source = "emergency_room",
length_of_stay_days = 1,
anatomical_system = "respiratory",
infection_type = "respiratory",
gcs_score = 14,
bilirubin_mg_dl = 0.8,
temperature_c = 38.5,
creatinine_mg_dl = 1.0,
heart_rate = 110,
wbc_count = 15,
ph_level = 7.35,
platelet_count = 250,
systolic_bp = 100,
mechanical_ventilation = 0,
pao2_fio2_ratio = 300,
vasoactive_drugs = 0,
comorbidities = NULL
)
Simplified Acute Physiology Score II (SAPS II)
Description
Calculates the SAPS II score and predicted hospital mortality for patients admitted to the ICU. The score uses 17 variables: 12 physiological variables, age, type of admission, and three underlying disease variables.
Usage
saps_ii_score(age, heart_rate, systolic_bp, temperature_c,
mechanical_ventilation_cpap, pao2, fio2, urine_output_24h_l,
bun, wbc_count, potassium, sodium, bicarbonate, bilirubin,
gcs, admission_type, chronic_diseases = NULL,
bun_units = "mg/dL", bilirubin_units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. |
heart_rate |
Numeric. Worst heart rate in the first 24 hours (bpm). |
systolic_bp |
Numeric. Worst systolic blood pressure in the first 24 hours (mmHg). |
temperature_c |
Numeric. Worst body temperature in the first 24 hours (Celsius). |
mechanical_ventilation_cpap |
Numeric (0 or 1). Is the patient on mechanical ventilation or CPAP? (1 = Yes). |
pao2 |
Numeric. PaO2 in mmHg (only used if ventilated). |
fio2 |
Numeric. FiO2 percentage or fraction (e.g., 50 or 0.5) (only used if ventilated). |
urine_output_24h_l |
Numeric. Urine output in Liters per 24 hours. |
bun |
Numeric. Blood Urea Nitrogen level. |
wbc_count |
Numeric. White Blood Cell count (x10^3/mm^3). |
potassium |
Numeric. Serum Potassium level (mmol/L). |
sodium |
Numeric. Serum Sodium level (mmol/L). |
bicarbonate |
Numeric. Serum Bicarbonate level (mEq/L). |
bilirubin |
Numeric. Total Bilirubin level. |
gcs |
Numeric. Glasgow Coma Scale score (3-15). |
admission_type |
String. "scheduled_surgical", "medical", or "unscheduled_surgical". |
chronic_diseases |
Vector of strings. List of comorbidities: "aids", "hematologic_malignancy", "metastatic_cancer". |
bun_units |
String. "mg/dL" (default) or "mmol/L". |
bilirubin_units |
String. "mg/dL" (default) or "umol/L". |
Value
A list containing:
SAPS_II_Score |
The calculated SAPS II score. |
Predicted_Hospital_Mortality |
The estimated probability of hospital mortality percentage. |
References
Le Gall JR, Lemeshow S, Saulnier F. A new Simplified Acute Physiology Score (SAPS II) based on a European/North American multicenter study. JAMA. 1993;270(24):2957-2963. doi:10.1001/jama.1993.03510240069035
Examples
saps_ii_score(
age = 65, heart_rate = 130, systolic_bp = 90, temperature_c = 39.0,
mechanical_ventilation_cpap = 1, pao2 = 70, fio2 = 50, urine_output_24h_l = 0.8,
bun = 35, wbc_count = 18, potassium = 4.0, sodium = 135, bicarbonate = 18,
bilirubin = 1.0, gcs = 10, admission_type = "medical",
chronic_diseases = c("metastatic_cancer")
)
SAVE Score for Veno-Arterial (VA) ECMO Survival
Description
Calculates the Survival After Veno-arterial ECMO (SAVE) Score to predict in-hospital survival for adult patients with refractory cardiogenic shock treated with VA-ECMO. The score stratifies patients into five risk classes based on 12 pre-ECMO clinical parameters.
Usage
save_ecmo_score(age, weight_kg, diagnosis_category, chronic_renal_failure,
acute_renal_failure, liver_failure, cns_dysfunction,
intubation_duration_hours, peak_inspiratory_pressure,
cardiac_arrest_pre_ecmo, diastolic_bp_pre_ecmo,
pulse_pressure_pre_ecmo, bicarbonate_pre_ecmo)
Arguments
age |
Numeric. Patient age in years. |
weight_kg |
Numeric. Patient weight in kg. |
diagnosis_category |
String. Etiology of cardiogenic shock. "chronic_heart_failure" (-5) "myocarditis" (+3) "refractory_vt_vf" (+2) "post_transplant" (+3) "congenital_heart_disease" (-3) "other" (-1) (e.g., postpartum, toxic, idiopathic) |
chronic_renal_failure |
Numeric (0 or 1). Chronic renal failure history (Stage 3+ or damage > 3 months). (1 = Yes, -6 pts). |
acute_renal_failure |
Numeric (0 or 1). Acute renal failure pre-ECMO. (1 = Yes, -3 pts). |
liver_failure |
Numeric (0 or 1). Liver failure (Bili >= 33 umol/L or Transaminases > 70 U/L). (1 = Yes, -3 pts). |
cns_dysfunction |
Numeric (0 or 1). Central nervous system dysfunction. (1 = Yes, -3 pts). |
intubation_duration_hours |
Numeric. Hours intubated prior to ECMO initiation. <= 10 hours (0 pts) 11-29 hours (-2 pts) >= 30 hours (-4 pts) |
peak_inspiratory_pressure |
Numeric. Peak inspiratory pressure (PIP) in cmH2O. (<= 20 cmH2O adds +3 pts). |
cardiac_arrest_pre_ecmo |
Numeric (0 or 1). Cardiac arrest prior to ECMO cannulation. (1 = Yes, -2 pts). |
diastolic_bp_pre_ecmo |
Numeric. Diastolic blood pressure pre-ECMO (worst value in 6h). (>= 40 mmHg adds +3 pts). |
pulse_pressure_pre_ecmo |
Numeric. Pulse pressure pre-ECMO (worst value in 6h). (<= 20 mmHg subtracts -2 pts). |
bicarbonate_pre_ecmo |
Numeric. Serum bicarbonate pre-ECMO (worst value in 6h). (<= 15 mmol/L subtracts -3 pts). |
Value
A list containing:
SAVE_Score |
The calculated total score (Range -35 to +17). |
Risk_Class |
Risk classification (Class I to V). |
Est_Hospital_Survival |
Estimated survival percentage. |
References
Schmidt M, Burrell A, Roberts L, et al. Predicting survival after ECMO for refractory cardiogenic shock: the survival after veno-arterial-ECMO (SAVE)-score. Eur Heart J. 2015;36(33):2246-2256. doi:10.1093/eurheartj/ehv162
Examples
# Example 1: Good Candidate (Class I)
# 30yo (+7), 70kg (+2), Myocarditis (+3), No Failures, 5h vent (0),
#PIP 18 (+3), No Arrest (0), DBP 60 (+3), PP 30 (0), HCO3 24 (0)
# Score = 7 + 2 + 3 + 0 + 3 + 0 + 3 = 18
save_ecmo_score(30, 70, "myocarditis", 0, 0, 0, 0, 5, 18, 0, 60, 30, 24)
# Example 2: Poor Candidate (Class V)
# 70yo (0), 80kg (+2), Chronic HF (-5), Chronic Renal (-6), 48h vent (-4),
#Arrest (-2), DBP 30 (0), PP 15 (-2), HCO3 12 (-3)
# Score = 0 + 2 - 5 - 6 - 4 - 2 - 2 - 3 = -20
save_ecmo_score(70, 80, "chronic_heart_failure", 1, 0, 0, 0, 48, 30, 1, 30, 15, 12)
Severe Community-Acquired Pneumonia (SCAP) Score
Description
Calculates the SCAP score to predict in-hospital mortality and the risk of severe adverse events (SAE) such as ICU admission or need for mechanical ventilation in patients with Community-Acquired Pneumonia. The score ranges from 0 to 59, stratifying patients into four risk classes.
Usage
scap_pneumonia_score(arterial_ph, systolic_bp, respiratory_rate, pao2, fio2,
bun, altered_mental_status, age, multilobar_involvement,
bun_units = "mg/dL")
Arguments
arterial_ph |
Numeric. Arterial pH level. (< 7.30 adds 13 points). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. (< 90 mmHg adds 11 points). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. (> 30/min adds 9 points). |
pao2 |
Numeric. Partial pressure of oxygen in arterial blood (mmHg). |
fio2 |
Numeric. Fraction of inspired oxygen (e.g., 0.21 for room air, or 21). Used to calculate P/F ratio. (P/F < 250 adds 6 points). |
bun |
Numeric. Blood Urea Nitrogen level. (> 30 mg/dL or > 10.7 mmol/L adds 5 points). |
altered_mental_status |
Numeric (0 or 1). Presence of altered mental status (confusion, disorientation). (1 = Yes, +5 points). |
age |
Numeric. Patient age in years. (>= 80 years adds 5 points). |
multilobar_involvement |
Numeric (0 or 1). Presence of multilobar infiltrates on chest X-ray. (1 = Yes, +5 points). |
bun_units |
String. Units for BUN input. Options: "mg/dL" (default) or "mmol/L". |
Value
A list containing:
SCAP_Score |
The calculated SCAP score. |
Risk_Class |
Risk classification (Low, Moderate, High, Very High). |
Severe_Adverse_Event_Risk |
Estimated risk of SAE (ICU admission, Mechanical Ventilation, or Death). |
In_Hospital_Mortality_Risk |
Estimated risk of in-hospital mortality. |
References
Espana PP, Capelastegui A, Gorordo I, et al. Development and validation of a clinical prediction rule for severe community-acquired pneumonia. Am J Respir Crit Care Med. 2006;174(11):1249-1256. doi:10.1164/rccm.200602-177OC
Examples
# Example 1: High Risk
# pH 7.25 (+13), SBP 85 (+11), RR 35 (+9), P/F 200 (+6), BUN 40 (+5)
# Score = 13 + 11 + 9 + 6 + 5 = 44
scap_pneumonia_score(7.25, 85, 35, 60, 0.3, 40, 0, 70, 0)
# Example 2: Low Risk
# pH 7.4, SBP 120, RR 20, P/F 300, BUN 15, Alert, Age 50, Unilobar
# Score = 0
scap_pneumonia_score(7.4, 120, 20, 90, 0.21, 15, 0, 50, 0)
Sequential Clinical Assessment of Respiratory Function (SCARF) Score
Description
Calculates the SCARF score to predict the risk of progression to severe pneumonia (composite of mechanical ventilation or death) in patients hospitalized with COVID-19. The score is based on respiratory rate, oxygen saturation, and the number of lung lobes affected on imaging.
Usage
scarf_score(respiratory_rate, spo2, lobes_affected)
Arguments
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. < 20: 0 pts. 20 - 24: 2 pts. 25 - 30: 4 pts. > 30: 6 pts. |
spo2 |
Numeric. Oxygen saturation percentage (SpO2). > 96: 0 pts. 94 - 96: 2 pts. 90 - 93: 4 pts. < 90: 6 pts. |
lobes_affected |
Numeric. Number of lung lobes affected on Chest X-ray or CT (0-5). 0 - 1: 0 pts. 2 - 3: 2 pts. > 3: 5 pts. |
Value
A list containing:
SCARF_Score |
The calculated total score (Range 0-17). |
Risk_Category |
Classification (Low, Moderate, High). |
Risk_of_Severe_Pneumonia |
Estimated probability of progression to severe pneumonia within 14 days. |
References
Doshi A, Shah P, Jariwala P, et al. Sequential Clinical Assessment of Respiratory Function (SCARF) Score: A Dynamic Prognostic Score for COVID-19. J Assoc Physicians India. 2021;69(1):11-12.
Examples
# Example 1: Low Risk
# RR 18 (0), SpO2 98 (0), 1 Lobe (0)
# Score = 0
scarf_score(18, 98, 1)
# Example 2: High Risk
# RR 26 (4), SpO2 92 (4), 4 Lobes (5)
# Score = 13
scarf_score(26, 92, 4)
Schwab and England Activities of Daily Living (ADL) Scale
Description
Retrieves the clinical description for the Schwab and England ADL Scale score. This scale assesses the ability of patients with Parkinson's disease or other movement disorders to perform daily activities independently. Scores range from 100% (completely independent) to 0% (vegetative functions not functioning).
Usage
schwab_england_adl_scale(score_percent)
Arguments
score_percent |
Numeric. The assessed score as a percentage. Must be a multiple of 10 between 0 and 100. |
Value
A list containing:
Schwab_England_Score |
The input score formatted as a percentage. |
Description |
The detailed clinical description of the patient's functional status. |
References
Schwab RS, England AC. Projection technique for evaluating surgery in Parkinson’s disease. In: Gillingham FJ, Donaldson MC, eds. Third Symposium on Parkinson’s Disease. Edinburgh, Scotland: E&S Livingstone; 1969:152-157.
Examples
# Example 1: Mild Impairment
schwab_england_adl_scale(90)
# Example 2: Severe Dependence
schwab_england_adl_scale(30)
SCOFF Questionnaire for Eating Disorders
Description
Calculates the SCOFF score, a 5-question screening tool designed to detect eating disorders (Anorexia Nervosa and Bulimia Nervosa). The acronym stands for Sick, Control, One stone, Fat, Food. A score of 2 or higher indicates a positive screen.
Usage
scoff_screening_tool(make_sick, lost_control, one_stone_loss, believe_fat,
food_dominates)
Arguments
make_sick |
Numeric (0 or 1). Do you make yourself Sick because you feel uncomfortably full? (1 = Yes). |
lost_control |
Numeric (0 or 1). Do you worry you have lost Control over how much you eat? (1 = Yes). |
one_stone_loss |
Numeric (0 or 1). Have you recently lost more than One stone (14 lbs or 6.35 kg) in a 3-month period? (1 = Yes). |
believe_fat |
Numeric (0 or 1). Do you believe yourself to be Fat when others say you are too thin? (1 = Yes). |
food_dominates |
Numeric (0 or 1). Would you say that Food dominates your life? (1 = Yes). |
Value
A list containing:
SCOFF_Score |
The calculated total score (Range 0-5). |
Result |
Interpretation of the screen (Positive >= 2). |
References
Morgan JF, Reid F, Lacey JH. The SCOFF questionnaire: assessment of a new screening tool for eating disorders. BMJ. 1999;319(7223):1467-1468. doi:10.1136/bmj.319.7223.1467
Examples
# Example 1: Positive Screen
# Lost control (1), Food dominates (1) -> Score 2
scoff_screening_tool(0, 1, 0, 0, 1)
# Example 2: Negative Screen
# No positive answers
scoff_screening_tool(0, 0, 0, 0, 0)
SCORE2 Risk Prediction Algorithm
Description
Calculates the 10-year risk of fatal and non-fatal cardiovascular disease (CVD) events in individuals aged 40-69 years without prior CVD or diabetes, using the SCORE2 algorithm. The model is calibrated for four European risk regions (Low, Moderate, High, Very High).
Usage
score2_cvd_risk(sex, age, smoking_status, systolic_bp, total_cholesterol,
hdl_cholesterol = NULL, region_risk_level = "low")
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age |
Numeric. Patient age in years (40-69). |
smoking_status |
Numeric (0 or 1). Current smoker status. (1 = Yes). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
total_cholesterol |
Numeric. Total cholesterol level in mmol/L or mg/dL. (If >15, assumed mg/dL and converted). |
hdl_cholesterol |
Numeric (Optional). HDL cholesterol level in mmol/L or mg/dL. Used to calculate non-HDL cholesterol. |
region_risk_level |
String. Risk region classification. Options: "low", "moderate", "high", "very_high". |
Value
A list containing:
SCORE2_Risk_10yr |
The estimated 10-year risk of fatal/non-fatal CVD. |
Risk_Category |
Risk classification based on age-specific thresholds. |
References
SCORE2 working group and ESC Cardiovascular Risk Collaboration. SCORE2 risk prediction algorithms: new models to estimate 10-year risk of cardiovascular disease in Europe. Eur Heart J. 2021;42(25):2439-2454. doi:10.1093/eurheartj/ehab309
Examples
# Example 1: Moderate Risk Region
# Male, 55yo, Smoker, SBP 140, Total Chol 5.5 mmol/L (Non-HDL approx 4.0)
score2_cvd_risk("male", 55, 1, 140, 5.5, 1.5, "moderate")
# Example 2: Low Risk Region
# Female, 60yo, Non-smoker, SBP 120, Non-HDL 3.0 mmol/L
score2_cvd_risk("female", 60, 0, 120, 3.0, 0, "low")
SCORE2-Diabetes Risk Algorithm
Description
Calculates the 10-year risk of fatal and non-fatal cardiovascular disease (CVD) in patients with type 2 diabetes. This algorithm is an extension of the SCORE2 model, calibrated for four European risk regions, and incorporates diabetes-specific risk factors including HbA1c, eGFR, and duration of diabetes.
Usage
score2_diabetes_risk(sex, age, smoking_status, systolic_bp, total_cholesterol,
hdl_cholesterol, hba1c, egfr, age_diabetes_diagnosis,
region_risk_level = "low", cholesterol_units = "mmol/L",
hba1c_units = "mmol/mol")
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age |
Numeric. Patient age in years (40-69). |
smoking_status |
Numeric (0 or 1). Current smoker status (1 = Yes). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
total_cholesterol |
Numeric. Total cholesterol level. |
hdl_cholesterol |
Numeric. HDL cholesterol level. |
hba1c |
Numeric. Glycated hemoglobin level. |
egfr |
Numeric. Estimated Glomerular Filtration Rate in mL/min/1.73m^2. |
age_diabetes_diagnosis |
Numeric. Age at diagnosis of diabetes in years (used to calculate duration). |
region_risk_level |
String. European risk region classification: "low", "moderate", "high", "very_high". |
cholesterol_units |
String. Units for cholesterol inputs: "mmol/L" (default) or "mg/dL". |
hba1c_units |
String. Units for HbA1c input: "mmol/mol" (default) or "per" (DCCT). |
Value
A list containing:
Calculated_Variables |
Derived values used in the regression model (Non-HDL, Duration, Centered Age). |
Message |
Note regarding the requirement for specific regression coefficients. |
References
SCORE2-Diabetes Working Group and the ESC Cardiovascular Risk Collaboration. SCORE2-Diabetes: 10-year cardiovascular risk prediction in type 2 diabetes. Eur Heart J. 2023;44(28):2544-2556. doi:10.1093/eurheartj/ehad260
Examples
# Example 1: Moderate Risk Region
# Male, 60yo, Smoker, SBP 140, TC 5.0, HDL 1.0, HbA1c 50 mmol/mol, eGFR 70, Dx age 50
score2_diabetes_risk("male", 60, 1, 140, 5.0, 1.0, 50, 70, 50, "moderate")
# Example 2: High Risk Region (US Units)
# Female, 55yo, Non-smoker, SBP 130, TC 200 mg/dL, HDL 50 mg/dL, HbA1c 7.5per, eGFR 55, Dx age 45
score2_diabetes_risk("female", 55, 0, 130, 200, 50, 7.5, 55, 45, "high", "mg/dL", "per")
SCORE2-OP Risk Prediction Algorithm (Older Persons)
Description
Calculates the 10-year risk of fatal and non-fatal cardiovascular disease (CVD) events in individuals aged 70-89 years, using the SCORE2-OP algorithm. This model accounts for the competing risk of non-CVD mortality in older populations and is calibrated for four European risk regions.
Usage
score2_op_risk(sex, age, smoking_status, systolic_bp, total_cholesterol,
hdl_cholesterol = NULL, region_risk_level = "low")
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age |
Numeric. Patient age in years (70-89). |
smoking_status |
Numeric (0 or 1). Current smoker status. (1 = Yes). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
total_cholesterol |
Numeric. Total cholesterol level in mmol/L or mg/dL. (If >15, assumed mg/dL and converted). |
hdl_cholesterol |
Numeric (Optional). HDL cholesterol level in mmol/L or mg/dL. Used to calculate non-HDL cholesterol. |
region_risk_level |
String. Risk region classification. Options: "low", "moderate", "high", "very_high". |
Value
A list containing:
SCORE2_OP_Risk_10yr |
The estimated 10-year risk of fatal/non-fatal CVD. |
Risk_Category |
Risk classification based on age-specific thresholds for older persons (<7.5per Low-Moderate, 7.5-15per High, >=15per Very High). |
References
SCORE2-OP working group and ESC Cardiovascular Risk Collaboration. SCORE2-OP risk prediction algorithms: estimating incident cardiovascular event risk in older persons in four geographical risk regions. Eur Heart J. 2021;42(25):2455-2467. doi:10.1093/eurheartj/ehab312
Examples
# Example 1: High Risk (75yo Male)
# Male, 75yo, Smoker, SBP 150, Total Chol 5.0 mmol/L, HDL 1.0, High Risk Region
score2_op_risk("male", 75, 1, 150, 5.0, 1.0, "high")
# Example 2: Low-to-Moderate Risk (80yo Female)
# Female, 80yo, Non-smoker, SBP 130, Total Chol 180 mg/dL, Low Risk Region
score2_op_risk("female", 80, 0, 130, 180, NULL, "low")
2HELPS2B Score for Inpatient Seizure Risk
Description
Calculates the 2HELPS2B score to estimate the risk of seizures in hospitalized patients undergoing continuous EEG (cEEG). Validated by Struck et al., this score uses clinical history and specific EEG findings (usually from the first hour of recording) to stratify patients into low, medium, or high risk, guiding the duration of monitoring.
Usage
score_2helps2b(frequency_gt_2hz, sporadic_discharges, lpd_lrda_bipd,
plus_features, prior_seizure, bird)
Arguments
frequency_gt_2hz |
Numeric (0 or 1). Presence of any periodic or rhythmic pattern with frequency > 2.0 Hz (excluding Generalized Rhythmic Delta Activity/GRDA). (+1 point). |
sporadic_discharges |
Numeric (0 or 1). Presence of independent sporadic epileptiform discharges. (+1 point). |
lpd_lrda_bipd |
Numeric (0 or 1). Presence of Lateralized Periodic Discharges (LPDs), Lateralized Rhythmic Delta Activity (LRDA), or Bilateral Independent Periodic Discharges (BIPDs). (+1 point). |
plus_features |
Numeric (0 or 1). Presence of "Plus" features (superimposed rhythmic, sharp, or fast activity). (+1 point). |
prior_seizure |
Numeric (0 or 1). History of prior seizure (acute or remote). (+1 point). |
bird |
Numeric (0 or 1). Presence of Brief Potentially Ictal Rhythmic Discharges (BIRDs). (+2 points). |
Value
A list containing:
Score |
The calculated 2HELPS2B score (Range 0-7). |
Risk_Category |
Risk classification (Low, Medium, or High). |
Seizure_Risk_Percentage |
Estimated probability of seizure activity (e.g., "5%", "12%", "27%", etc.). |
Recommended_Monitoring |
Suggested duration of cEEG based on risk (1 hour, 12 hours, or 24+ hours). |
References
Struck AF, et al. Assessment of the Validity of the 2HELPS2B Score for Inpatient Seizure Risk Prediction. JAMA Neurol. 2020;77(4):500-507. doi:10.1001/jamaneurol.2019.4656
Examples
# Example 1: High Risk Patient
# LPDs present (+1), Plus features (+1), Prior seizure (+1) = Score 3
score_2helps2b(0, 0, 1, 1, 1, 0)
# Example 2: Low Risk Patient
# No abnormalities, no history of seizure = Score 0
score_2helps2b(0, 0, 0, 0, 0, 0)
# Example 3: Very High Risk
# BIRDs present (+2), Frequency > 2Hz (+1) = Score 3
score_2helps2b(1, 0, 0, 0, 0, 1)
4AT: 4-Test Delirium Assessment
Description
Calculates the 4AT score to screen for delirium and cognitive impairment. The 4AT is a rapid (<2 min) validated tool used in clinical settings. It assesses Alertness, the AMT4 (Abbreviated Mental Test - 4), Attention (Months Backwards), and Acute Change.
Usage
score_4at(alertness, amt4_mistakes, attention_months, acute_change)
Arguments
alertness |
Numeric. 0 = Normal (fully alert, not agitated). 1 = Mild sleepiness for < 10 seconds after waking, then normal. 2 = Clearly abnormal (markedly drowsy or agitated). (Note: Scores 0 or 1 result in 0 points; Score 2 results in 4 points). |
amt4_mistakes |
Numeric. Number of mistakes on the AMT4 (Age, Date of Birth, Place, Current Year). 0 = No mistakes (0 points). 1 = 1 mistake (1 point). 2 = 2 or more mistakes or Untestable (2 points). |
attention_months |
Numeric. Performance on "Months of the year backwards". 0 = Achieves 7 months or more correctly (0 points). 1 = Starts but scores < 7 months / refuses (1 point). 2 = Untestable (cannot start due to unwell/drowsy/inattentive) (2 points). |
acute_change |
Numeric. Evidence of significant change or fluctuation in mental status. 0 = No (0 points). 1 = Yes (4 points). |
Value
A list containing:
Total_Score |
Sum of the component scores (Range 0-12). |
Interpretation |
Clinical interpretation: "Delirium unlikely" (0), "Possible cognitive impairment" (1-3), or "Possible delirium" (4+). |
Item_Breakdown |
Individual scores for each of the 4 items. |
References
Bellelli G, et al. Validation of the 4AT, a new instrument for rapid delirium screening: a study in 234 hospitalised older people. Age Ageing. 2014;43(4):496-502. doi:10.1093/ageing/afu021
Examples
# Example 1: Possible Delirium
# Clearly abnormal alertness (Score 4), Untestable AMT4 (Score 2),
# Untestable Attention (Score 2), Acute Change Yes (Score 4) -> Total 12
score_4at(2, 2, 2, 1)
# Example 2: Normal
# Fully alert, 0 mistakes, >7 months correct, No acute change -> Total 0
score_4at(0, 0, 0, 0)
# Example 3: Possible Cognitive Impairment
# Alert, 1 mistake on AMT4, Refuses attention test, No acute change -> Total 2
score_4at(0, 1, 1, 0)
4-Level Pulmonary Embolism Clinical Probability Score (4PEPS)
Description
Calculates the 4PEPS score to stratify the clinical probability of pulmonary embolism (PE). This scoring system integrates clinical variables to assign patients into one of four risk categories (Very Low, Low, Moderate, High), each with a specific diagnostic strategy involving D-dimer testing cutoffs or imaging.
Usage
score_4peps(age, sex, chronic_resp_disease, heart_rate_lt_80,
chest_pain_and_dyspnea, estrogen_use, history_vte,
syncope, immobility_4wks, o2_sat_lt_95,
calf_pain_unilateral_edema, pe_most_likely)
Arguments
age |
Numeric. Patient age in years. (<50 years = -2 points; 50-64 years = -1 point; >=65 years = 0 points). |
sex |
String. Patient sex ("Male" or "Female"). (Male = +2 points; Female = 0 points). |
chronic_resp_disease |
Numeric (0 or 1). History of chronic respiratory disease. (Yes = -1 point). |
heart_rate_lt_80 |
Numeric (0 or 1). Heart rate < 80 bpm. (Yes = -1 point). |
chest_pain_and_dyspnea |
Numeric (0 or 1). Presence of BOTH chest pain AND acute dyspnea. (Yes = +1 point). |
estrogen_use |
Numeric (0 or 1). Current estrogen use (contraception or replacement). (Yes = +2 points). |
history_vte |
Numeric (0 or 1). Prior history of VTE (DVT or PE). (Yes = +2 points). |
syncope |
Numeric (0 or 1). History of syncope related to current event. (Yes = +2 points). |
immobility_4wks |
Numeric (0 or 1). Immobility (bedridden >3 days, surgery, or lower limb cast) within the last 4 weeks. (Yes = +2 points). |
o2_sat_lt_95 |
Numeric (0 or 1). O2 saturation < 95% on room air. (Yes = +3 points). |
calf_pain_unilateral_edema |
Numeric (0 or 1). Calf pain and/or unilateral lower limb edema. (Yes = +3 points). |
pe_most_likely |
Numeric (0 or 1). Pulmonary Embolism is the most likely diagnosis. (Yes = +5 points). |
Value
A list containing:
Score |
Total 4PEPS score. |
Risk_Category |
Clinical probability category (Very Low, Low, Moderate, High). |
Management_Strategy |
Recommended diagnostic action (e.g., rule out without testing, specific D-dimer cutoff, or imaging). |
References
Roy PM, et al. Derivation and Validation of a 4-Level Clinical Pretest Probability Score for Suspected Pulmonary Embolism to Safely Decrease Imaging Testing. JAMA Cardiol. 2021;6(6):669-677. doi:10.1001/jamacardio.2021.0064
Examples
# Example 1: Very Low Risk
# 35yo Female (-2), HR < 80 (-1), No other risks -> Score -3
score_4peps(35, "female", 0, 1, 0, 0, 0, 0, 0, 0, 0, 0)
# Example 2: Moderate Risk
# 55yo Male (-1 + 2), Chest Pain/Dyspnea (+1), PE Most Likely (+5) -> Score 7
score_4peps(55, "male", 0, 0, 1, 0, 0, 0, 0, 0, 0, 1)
# Example 3: High Risk
# 70yo Female (0), Immobility (+2), O2 <95% (+3),
#Unilateral Edema (+3), PE Most Likely (+5) -> Score 13
score_4peps(70, "female", 0, 0, 0, 0, 0, 0, 1, 1, 1, 1)
SCORTEN: Severity-of-Illness Score for Toxic Epidermal Necrolysis
Description
Calculates the SCORTEN score to predict mortality in patients with Toxic Epidermal Necrolysis (TEN) or Stevens-Johnson Syndrome (SJS). The score is calculated within the first 24 hours of admission and consists of seven independent risk factors.
Usage
scorten_score(age_years, heart_rate, malignancy, bsa_detached_percent,
bun, bicarbonate, glucose, bun_units = "mg/dL",
glucose_units = "mg/dL")
Arguments
age_years |
Numeric. Patient age in years. (>= 40 years adds 1 point). |
heart_rate |
Numeric. Heart rate in beats per minute. (>= 120 bpm adds 1 point). |
malignancy |
Numeric (0 or 1). Presence of associated cancer/malignancy. (1 = Yes, adds 1 point). |
bsa_detached_percent |
Numeric. Percentage of body surface area detached. (>= 10% adds 1 point). |
bun |
Numeric. Serum Urea (BUN) level. (> 10 mmol/L or > 28 mg/dL adds 1 point). |
bicarbonate |
Numeric. Serum Bicarbonate level in mmol/L (mEq/L). (< 20 mmol/L adds 1 point). |
glucose |
Numeric. Serum Glucose level. (> 14 mmol/L or > 252 mg/dL adds 1 point). |
bun_units |
String. Units for BUN input. Options: "mg/dL" (default) or "mmol/L". |
glucose_units |
String. Units for Glucose input. Options: "mg/dL" (default) or "mmol/L". |
Value
A list containing:
SCORTEN_Score |
The calculated total score (Range 0-7). |
Estimated_Mortality |
The estimated probability of hospital mortality based on the score. |
References
Bastuji-Garin S, Fouchard N, Bertocchi M, et al. SCORTEN: a severity-of-illness score for toxic epidermal necrolysis. J Invest Dermatol. 2000;115(2):149-153. doi:10.1046/j.1523-1747.2000.00061.x
Examples
# Example 1: Low Risk
# 30yo, HR 80, No cancer, 5% BSA, BUN 15 mg/dL, Bicarb 24, Glucose 100 mg/dL
# Score = 0
scorten_score(30, 80, 0, 5, 15, 24, 100)
# Example 2: High Risk
# 50yo (+1), HR 130 (+1), No cancer, 20% BSA (+1),
#BUN 40 mg/dL (+1), Bicarb 18 (+1), Glucose 300 mg/dL (+1)
# Score = 6
scorten_score(50, 130, 0, 20, 40, 18, 300)
Simple Disease Activity Index (SDAI) for Rheumatoid Arthritis
Description
Calculates the SDAI score to assess disease activity in Rheumatoid Arthritis. The score is a simple sum of five components: tender joint count (28), swollen joint count (28), patient global assessment (0-10), provider global assessment (0-10), and C-reactive protein (mg/dL).
Usage
sdai_rheumatoid_arthritis(tender_joint_count_28, swollen_joint_count_28,
patient_global_assessment, provider_global_assessment,
crp_mg_dl)
Arguments
tender_joint_count_28 |
Numeric (0-28). Number of tender joints upon examination. |
swollen_joint_count_28 |
Numeric (0-28). Number of swollen joints upon examination. |
patient_global_assessment |
Numeric (0-10). Patient's global assessment of disease activity on a 0-10 visual analog scale (VAS). |
provider_global_assessment |
Numeric (0-10). Provider's global assessment of disease activity on a 0-10 visual analog scale (VAS). |
crp_mg_dl |
Numeric. Serum C-Reactive Protein level in mg/dL. |
Value
A list containing:
SDAI_Score |
The calculated total score (Sum of 5 components). |
Disease_Activity |
Classification (Remission <= 3.3, Low <= 11, Moderate <= 26, High > 26). |
References
Smolen JS, Breedveld FC, Schiff MH, et al. A simplified disease activity index for rheumatoid arthritis for use in clinical practice. Rheumatology (Oxford). 2003;42(2):244-257. doi:10.1093/rheumatology/keg072
Examples
# Example 1: High Activity
# 10 tender, 8 swollen, Pat GA 6, Prov GA 5, CRP 2.0
# Score = 10 + 8 + 6 + 5 + 2.0 = 31
sdai_rheumatoid_arthritis(10, 8, 6, 5, 2.0)
# Example 2: Remission
# 0 tender, 0 swollen, Pat GA 0.5, Prov GA 0.5, CRP 0.2
# Score = 0 + 0 + 0.5 + 0.5 + 0.2 = 1.2
sdai_rheumatoid_arthritis(0, 0, 0.5, 0.5, 0.2)
Seattle Heart Failure Model (SHFM)
Description
Calculates the Seattle Heart Failure Model (SHFM) risk score to predict 1-, 2-, and 5-year survival and median life expectancy in patients with heart failure. The model integrates clinical status, pharmacological and device therapy, and laboratory parameters.
Usage
seattle_heart_failure_model(age, sex, nyha_class, ejection_fraction, systolic_bp,
ischemic_etiology, weight_kg,
diuretic_daily_furosemide_equiv_mg,
hemoglobin_g_dl, lymphocyte_percent, uric_acid_mg_dl,
sodium_meq_l, cholesterol_mg_dl, qrs_duration_ms,
ace_inhibitor, beta_blocker, statin, allopurinol,
aldosterone_blocker, icd_device, crt_device)
Arguments
age |
Numeric. Patient age in years. |
sex |
String. "Male" or "Female". |
nyha_class |
Numeric. NYHA Functional Class (1-4). |
ejection_fraction |
Numeric. Left Ventricular Ejection Fraction (LVEF) in percent. |
systolic_bp |
Numeric. Systolic Blood Pressure in mmHg. |
ischemic_etiology |
Numeric (0 or 1). Ischemic etiology of heart failure (1 = Yes). |
weight_kg |
Numeric. Patient weight in kilograms. |
diuretic_daily_furosemide_equiv_mg |
Numeric. Total daily diuretic dose in furosemide equivalents (mg). |
hemoglobin_g_dl |
Numeric. Hemoglobin level in g/dL. |
lymphocyte_percent |
Numeric. Lymphocyte percentage of total WBC. |
uric_acid_mg_dl |
Numeric. Serum Uric Acid level in mg/dL. |
sodium_meq_l |
Numeric. Serum Sodium level in mEq/L. |
cholesterol_mg_dl |
Numeric. Total Cholesterol in mg/dL. |
qrs_duration_ms |
Numeric. QRS duration in ms (used for CRT benefit assessment). |
ace_inhibitor |
Numeric (0 or 1). Use of ACE Inhibitor or ARB. (1 = Yes). |
beta_blocker |
Numeric (0 or 1). Use of Beta-Blocker. (1 = Yes). |
statin |
Numeric (0 or 1). Use of Statin. (1 = Yes). |
allopurinol |
Numeric (0 or 1). Use of Allopurinol. (1 = Yes). |
aldosterone_blocker |
Numeric (0 or 1). Use of Aldosterone Blocker (e.g., Spironolactone). (1 = Yes). |
icd_device |
Numeric (0 or 1). Presence of Implantable Cardioverter Defibrillator (ICD). (1 = Yes). |
crt_device |
Numeric (0 or 1). Presence of Cardiac Resynchronization Therapy (CRT). (1 = Yes). |
Value
A list containing:
SHFM_Score |
The calculated log-hazard score. |
Est_1_Year_Survival |
Estimated survival probability at 1 year. |
Est_2_Year_Survival |
Estimated survival probability at 2 years. |
Est_5_Year_Survival |
Estimated survival probability at 5 years. |
Est_Median_Survival |
Estimated median life expectancy in years. |
References
Levy WC, Mozaffarian D, Linker DT, et al. The Seattle Heart Failure Model: prediction of survival in heart failure. Circulation. 2006;113(11):1424-1433. doi:10.1161/CIRCULATIONAHA.105.584102
Examples
# Example: High Risk Patient
seattle_heart_failure_model(
age = 75, sex = "male", nyha_class = 3, ejection_fraction = 25,
systolic_bp = 110, ischemic_etiology = 1, weight_kg = 80,
diuretic_daily_furosemide_equiv_mg = 80, hemoglobin_g_dl = 11,
lymphocyte_percent = 15, uric_acid_mg_dl = 8.0, sodium_meq_l = 135,
cholesterol_mg_dl = 180, qrs_duration_ms = 120,
ace_inhibitor = 1, beta_blocker = 0, statin = 0, allopurinol = 0,
aldosterone_blocker = 0, icd_device = 0, crt_device = 0
)
SEDAN Score for Post-tPA Hemorrhage Risk
Description
Calculates the SEDAN score to estimate the risk of symptomatic intracranial hemorrhage (sICH) in patients with acute ischemic stroke treated with intravenous tissue plasminogen activator (tPA). The score is derived from: Sugar (glucose), Early infarct signs, Dense cerebral artery sign, Age, and NIHSS.
Usage
sedan_score_hemorrhage(glucose, early_infarct_signs, hyperdense_artery_sign,
age, nihss_score, glucose_units = "mmol/L")
Arguments
glucose |
Numeric. Baseline blood glucose level. |
early_infarct_signs |
Numeric (0 or 1). Presence of early infarct signs on initial CT scan. (1 = Yes, +1 point). |
hyperdense_artery_sign |
Numeric (0 or 1). Presence of hyperdense cerebral artery sign on initial CT scan. (1 = Yes, +1 point). |
age |
Numeric. Patient age in years. (> 75 years adds 1 point). |
nihss_score |
Numeric. Baseline NIH Stroke Scale score. (>= 10 adds 1 point). |
glucose_units |
String. Units for glucose input. Options: "mmol/L" (default) or "mg/dL". Scoring: <= 8.0 mmol/L (144 mg/dL): 0 pts 8.1 - 12.0 mmol/L (145-216 mg/dL): 1 pt > 12.0 mmol/L (216 mg/dL): 2 pts |
Value
A list containing:
SEDAN_Score |
The calculated total score (Range 0-6). |
Risk_sICH |
The estimated percentage risk of symptomatic intracranial hemorrhage. |
Risk_Category |
General risk classification. |
References
Strbian D, Engelter S, Michel P, et al. Symptomatic intracranial hemorrhage after stroke thrombolysis: the SEDAN score. Ann Neurol. 2012;71(5):634-641. doi:10.1002/ana.23546
Examples
# Example 1: High Risk
# Glucose 250 mg/dL (>12 mmol/L -> 2 pts), Age 80 (+1), NIHSS 15 (+1)
# Score = 4
sedan_score_hemorrhage(250, 0, 0, 80, 15, "mg/dL")
# Example 2: Low Risk
# Glucose 5.5 mmol/L, Age 60, NIHSS 5, No CT signs
# Score = 0
sedan_score_hemorrhage(5.5, 0, 0, 60, 5)
SETscore for Stroke Risk Stratification
Description
Calculates the SETscore, a simple clinical tool to help differentiate acute ischemic stroke from stroke mimics in the emergency department. The score is based on three components: Stroke-associated history (S), ECG T-wave inversion (E), and Troponin elevation (T).
Usage
set_score(stroke_associated_history_present, ecg_t_wave_inversion,
troponin_elevated)
Arguments
stroke_associated_history_present |
Numeric (0 or 1). Does the patient have a history strongly associated with stroke? Defined as: History of stroke/TIA OR History of Atrial Fibrillation. (1 = Yes). |
ecg_t_wave_inversion |
Numeric (0 or 1). Are there new T-wave inversions on ECG? (1 = Yes). |
troponin_elevated |
Numeric (0 or 1). Is the serum troponin level elevated (above the 99th percentile upper reference limit)? (1 = Yes). |
Value
A list containing:
SET_Score |
The calculated score (Range 0-4). |
Recommendation |
Clinical guidance based on the score threshold (Score >= 2 suggests stroke). |
References
Wong CS, et al. A new score to differentiate stroke from stroke mimics: The SETscore. J Stroke Cerebrovasc Dis. 2021.
Examples
# Example 1: Stroke Likely
# History of AFib (1 -> +2), T-wave inversion (1 -> +1), Normal Trop (0)
# Score = 3
set_score(1, 1, 0)
# Example 2: Unlikely Stroke
# No history, Normal ECG, Normal Trop
# Score = 0
set_score(0, 0, 0)
SEX-SHOCK Risk Score for Cardiogenic Shock in ACS
Description
Calculates the SEX-SHOCK Risk Score to predict the risk of developing in-hospital cardiogenic shock (CS) in patients admitted with Acute Coronary Syndrome (ACS) treated with PCI. This score was developed to address sex-specific disparities in risk prediction, outperforming the ORBI score in women by incorporating biomarkers (CRP, Creatinine) and LVEF alongside traditional factors.
Usage
sex_shock_score(sex, age, st_segment_elevation, lvef_category, creatinine, crp,
creatinine_units = "mg/dL")
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age |
Numeric. Patient age in years. |
st_segment_elevation |
Numeric (0 or 1). Presence of ST-segment elevation on presenting ECG (i.e., STEMI). (1 = Yes). |
lvef_category |
String. Left Ventricular Ejection Fraction category. "lt_35": < 35%. "35_50": 35-50%. "gt_50": > 50%. |
creatinine |
Numeric. Serum creatinine level on admission. |
crp |
Numeric. C-Reactive Protein level on admission (mg/L). |
creatinine_units |
String. Units for creatinine input. Options: "mg/dL" (default) or "umol/L". |
Value
A list containing:
Inputs |
A summary of the patient variables provided for risk stratification. |
Message |
Information regarding the model source (Wang et al., 2024). |
References
Wang W, et al. Sex-specific prediction of cardiogenic shock after acute coronary syndromes: the SEX-SHOCK score. Eur Heart J. 2024. doi:10.1093/eurheartj/ehae593
Examples
# Example: 65yo Female with STEMI, LVEF 40%, Cr 1.0, CRP 15
sex_shock_score("female", 65, 1, "35_50", 1.0, 15, "mg/dL")
SpO2/FiO2 Ratio (S/F Ratio)
Description
Calculates the SpO2/FiO2 (S/F) ratio, a non-invasive surrogate for the PaO2/FiO2 (P/F) ratio used to assess the severity of hypoxemia and acute respiratory distress syndrome (ARDS)
[Image of oxygen gradient diagram] . The S/F ratio correlates with the P/F ratio, with S/F values of 235 and 315 corresponding approximately to P/F values of 200 and 300, respectively.
Usage
sf_ratio(spo2_percent, fio2_percent)
Arguments
spo2_percent |
Numeric. Oxygen saturation as measured by pulse oximetry (0-100%). |
fio2_percent |
Numeric. Fraction of Inspired Oxygen (can be entered as a percentage e.g., 40, or decimal e.g., 0.40). |
Value
A list containing:
SF_Ratio |
The calculated S/F ratio. |
Interpretation |
Clinical interpretation regarding ARDS severity. |
Estimated_PF_Ratio |
Approximate corresponding P/F ratio range. |
References
Rice TW, Wheeler AP, Bernard GR, et al. Comparison of the SpO2/FIO2 ratio and the PaO2/FIO2 ratio in patients with acute lung injury or ARDS. Chest. 2007;132(2):410-417. doi:10.1378/chest.07-0617
Examples
# Example 1: Severe Hypoxemia (ARDS)
# SpO2 88%, FiO2 0.60
# Ratio = 88 / 0.6 = 146.7
sf_ratio(88, 60)
# Example 2: Normal/Mild
# SpO2 98%, Room Air (0.21)
# Ratio = 98 / 0.21 = 466.7
sf_ratio(98, 21)
Sgarbossa's Criteria for MI in Left Bundle Branch Block
Description
Calculates the Sgarbossa Score to diagnose Acute Myocardial Infarction (AMI) in the presence of Left Bundle Branch Block (LBBB) or a paced rhythm. A total score of 3 or greater is reported to have high specificity for diagnosing AMI.
Usage
sgarbossa_criteria(concordant_ste_gt_1mm, concordant_std_v1_v3,
discordant_ste_gt_5mm)
Arguments
concordant_ste_gt_1mm |
Numeric (0 or 1). ST-segment elevation >= 1 mm concordant with the QRS complex in any lead. (1 = Yes, +5 points). |
concordant_std_v1_v3 |
Numeric (0 or 1). ST-segment depression >= 1 mm in lead V1, V2, or V3. (1 = Yes, +3 points). |
discordant_ste_gt_5mm |
Numeric (0 or 1). ST-segment elevation >= 5 mm discordant with the QRS complex (Original criterion). (1 = Yes, +2 points). |
Value
A list containing:
Sgarbossa_Score |
The calculated score (Range 0-10). |
Result |
Interpretation of the score regarding the likelihood of AMI. |
References
Sgarbossa EB, Pinski SL, Barbagelata A, et al. Electrocardiographic diagnosis of evolving acute myocardial infarction in the presence of left bundle-branch block. GUSTO-1 (Global Utilization of Streptokinase and Tissue Plasminogen Activator for Occluded Coronary Arteries) Investigators. N Engl J Med. 1996;334(8):481-487. doi:10.1056/NEJM199602223340801
Examples
# Example 1: Positive for AMI
# Concordant STE (5 pts)
sgarbossa_criteria(1, 0, 0)
# Example 2: Negative
# Only Discordant STE > 5mm (2 pts)
sgarbossa_criteria(0, 0, 1)
Shanghai Score for Severe Acute Pancreatitis
Description
Calculates the Shanghai Score to predict the risk of Severe Acute Pancreatitis (SAP). This scoring system uses simple, objective clinical and laboratory parameters available within 24 hours of admission to stratify patients into low or high risk categories.
Usage
shanghai_pancreatitis_score(bmi, age, pleural_effusion, hematocrit,
creatinine, ldh, creatinine_units = "mg/dL")
Arguments
bmi |
Numeric. Body Mass Index in kg/m^2. (>= 25 adds 1 point). |
age |
Numeric. Patient age in years. (>= 60 adds 1 point). |
pleural_effusion |
Numeric (0 or 1). Presence of pleural effusion on imaging (CXR or CT). (1 = Yes, adds 1 point). |
hematocrit |
Numeric. Hematocrit percentage on admission. (>= 46% adds 1 point). |
creatinine |
Numeric. Serum creatinine on admission. (>= 1.6 mg/dL adds 1 point). |
ldh |
Numeric. Lactate Dehydrogenase level in U/L on admission. (>= 340 U/L adds 1 point). |
creatinine_units |
String. Units for creatinine input. Options: "mg/dL" (default) or "umol/L". |
Value
A list containing:
Shanghai_Score |
The calculated total score (Range 0-6). |
Risk_Category |
Interpretation of risk (Low Risk < 2, High Risk >= 2). |
References
Liu Y, et al. A simple scoring system to predict the severity of acute pancreatitis. World J Gastroenterol. 2017;23(44):7847-7853. doi:10.3748/wjg.v23.i44.7847
Examples
# Example 1: High Risk
# BMI 28 (+1), Age 65 (+1), Pleural Effusion (+1), Hct 48 (+1), Cr 1.8 (+1), LDH 400 (+1)
# Score = 6
shanghai_pancreatitis_score(28, 65, 1, 48, 1.8, 400)
# Example 2: Low Risk
# BMI 22, Age 40, No effusion, Hct 40, Cr 0.8, LDH 200
# Score = 0
shanghai_pancreatitis_score(22, 40, 0, 40, 0.8, 200)
Shapiro Rule for Bacteremia
Description
Calculates the Shapiro Rule result to determine if blood cultures are indicated for a febrile patient in the emergency department. The rule identifies patients at high risk for bacteremia based on major and minor criteria. Blood cultures are recommended if at least one Major criterion or at least two Minor criteria are present.
Usage
shapiro_rule_bacteremia(age, shaking_chills, vomiting, temperature_c, systolic_bp,
wbc_count, creatinine, bands_percent, platelet_count,
suspected_endocarditis, indwelling_vascular_catheter)
Arguments
age |
Numeric. Patient age in years. (> 65 years is a Minor criterion). |
shaking_chills |
Numeric (0 or 1). Presence of shaking chills (rigors). (1 = Yes, Minor criterion). |
vomiting |
Numeric (0 or 1). Presence of vomiting. (1 = Yes, Minor criterion). |
temperature_c |
Numeric. Body temperature in degrees Celsius. (> 39.4 C is a Major criterion). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. (< 90 mmHg is a Minor criterion). |
wbc_count |
Numeric. White blood cell count in cells/uL. (> 18,000 is a Minor criterion). |
creatinine |
Numeric. Serum creatinine in mg/dL. (> 2.0 mg/dL is a Minor criterion). |
bands_percent |
Numeric. Percentage of band forms (neutrophils). (> 5% is a Minor criterion). |
platelet_count |
Numeric. Platelet count in cells/uL. (< 150,000 is a Minor criterion). |
suspected_endocarditis |
Numeric (0 or 1). Clinical suspicion of endocarditis. (1 = Yes, Major criterion). |
indwelling_vascular_catheter |
Numeric (0 or 1). Presence of an indwelling vascular catheter. (1 = Yes, Major criterion). |
Value
A list containing:
Recommendation |
Guidance on whether blood cultures are indicated. |
Major_Criteria_Met |
Count of major criteria met. |
Minor_Criteria_Met |
Count of minor criteria met. |
References
Shapiro NI, Wolfe RE, Wright SB, Moore R, Bates DW. Who needs a blood culture? A prospectively derived and validated prediction rule. J Emerg Med. 2008;35(3):255-264. doi:10.1016/j.jemermed.2007.08.056
Examples
# Example 1: Indicated (1 Major)
# Suspected Endocarditis
shapiro_rule_bacteremia(40, 0, 0, 38.0, 120, 10000, 1.0, 0, 200000, 1, 0)
# Example 2: Indicated (2 Minor)
# Age 70, Vomiting
shapiro_rule_bacteremia(70, 0, 1, 38.0, 120, 10000, 1.0, 0, 200000, 0, 0)
# Example 3: Not Indicated
# 40yo, Fever 38.5, no other signs
shapiro_rule_bacteremia(40, 0, 0, 38.5, 120, 10000, 1.0, 0, 200000, 0, 0)
Shock Index (SI)
Description
Calculates the Shock Index (SI), a bedside assessment tool used to evaluate the hemodynamic stability of patients, particularly in trauma or acute critical illness. It is defined as the ratio of heart rate to systolic blood pressure.
Usage
shock_index(heart_rate, systolic_bp)
Arguments
heart_rate |
Numeric. Heart rate in beats per minute (bpm). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
Details
The formula is:
SI = \frac{HR}{SBP}
Normal values typically range from 0.5 to 0.7. Values > 0.9 are associated with increased risk of mortality, need for massive transfusion, and occult shock even when blood pressure appears normal.
Value
A list containing:
Shock_Index |
The calculated index value. |
Interpretation |
Clinical context regarding the score (Normal, Elevated, High). |
References
Allgöwer M, Burri C. Shock index. Dtsch Med Wochenschr. 1967;43:1-10. Rady MY, Smithline HA, Blake H, Nowak R, Rivers E. A comparison of the shock index and ordinary vital signs to identify trauma patients with extensive major injury. Ann Emerg Med. 1994;24(4):685-690.
Examples
# Example 1: Normal
# HR 70, SBP 120
# SI = 0.58
shock_index(70, 120)
# Example 2: High Risk (Occult Shock)
# HR 110, SBP 100
# SI = 1.1
shock_index(110, 100)
Shorr Score for MRSA Pneumonia
Description
Calculates the Shorr Score to predict the probability of Methicillin-resistant Staphylococcus aureus (MRSA) etiology in patients with pneumonia. The score helps identify patients at low risk who may not require empiric anti-MRSA therapy.
Usage
shorr_score_mrsa(age, nursing_home, heart_failure, cerebrovascular_disease,
diabetes, icu_admission_24h)
Arguments
age |
Numeric. Patient age in years. <30: 0 pts 30-39: 1 pt 40-49: 2 pts 50-59: 3 pts 60-69: 4 pts 70-79: 5 pts >=80: 6 pts |
nursing_home |
Numeric (0 or 1). Residence in a nursing home or extended care facility. (1 = Yes, +4 pts). |
heart_failure |
Numeric (0 or 1). History of heart failure. (1 = Yes, +2 pts). |
cerebrovascular_disease |
Numeric (0 or 1). History of cerebrovascular disease (e.g., stroke, TIA). (1 = Yes, +2 pts). |
diabetes |
Numeric (0 or 1). History of diabetes mellitus. (1 = Yes, +1 pt). |
icu_admission_24h |
Numeric (0 or 1). Admission to the ICU within 24 hours of presentation. (1 = Yes, +2 pts). |
Value
A list containing:
Shorr_Score |
The calculated total score (Range 0-17). |
Risk_Category |
Classification (Low 0-1, Intermediate 2-5, High >=6). |
References
Shorr AF, Zilberberg MD, Micek ST, Kollef MH. Prediction of infection due to antibiotic-resistant bacteria by select risk factors for health care-associated pneumonia. Arch Intern Med. 2008;168(20):2205-2210. doi:10.1001/archinte.168.20.2205
Examples
# Example 1: Low Risk
# Age 45 (+2), No other factors
# Score = 2
# Let's recheck 45yo -> 2 pts.
# 2 points -> Intermediate.
shorr_score_mrsa(45, 0, 0, 0, 0, 0)
# Example 2: High Risk
# Age 80 (+6), Nursing Home (+4), Diabetes (+1)
# Score = 11
shorr_score_mrsa(80, 1, 0, 0, 1, 0)
Short Michigan Alcoholism Screening Test (SMAST)
Description
Calculates the SMAST score, a 13-item screening tool used to identify individuals with potential alcoholism. Each "Yes" response indicates a problem with alcohol use and contributes 1 point to the total score.
Usage
short_mast_alcohol_screen(trouble_stopping_drinking, family_complain,
bad_feeling_past_week, needed_morning_drink,
friends_complain, neglected_obligations,
shakes_morning, memory_loss, medical_advice_reduce,
dui_arrest, history_hospitalization, help_for_drinking,
lost_friends_girl_boy)
Arguments
trouble_stopping_drinking |
Numeric (0 or 1). Do you feel you are a normal drinker? (Note: In standard SMAST, "No" to "Normal drinker" scores 1. Here, input 1 if problem/abnormal perception exists, or map accordingly. Assuming input reflects the "scored response" (1 = Yes to problem/No to normal)). Let's assume inputs are 1 for the "alcoholism-indicative" response. |
family_complain |
Numeric (0 or 1). Does your wife, husband, a parent, or other near relative ever worry or complain about your drinking? (1 = Yes). |
bad_feeling_past_week |
Numeric (0 or 1). Do you ever feel guilty about your drinking? (1 = Yes). |
needed_morning_drink |
Numeric (0 or 1). Do you ever feel the need to cut down on your drinking? (1 = Yes). (Note: Question text varies, but standard SMAST items align with these themes). |
friends_complain |
Numeric (0 or 1). Are you able to stop drinking when you want to? (If No -> 1 pt). (Input 1 if "Unable to stop"). |
neglected_obligations |
Numeric (0 or 1). Have you ever neglected your family because of your use of alcohol? (1 = Yes). |
shakes_morning |
Numeric (0 or 1). Have you ever had the shakes in the morning after drinking? (1 = Yes). |
memory_loss |
Numeric (0 or 1). Have you ever had blackouts? (1 = Yes). |
medical_advice_reduce |
Numeric (0 or 1). Have you ever been told by a doctor to stop drinking? (1 = Yes). |
dui_arrest |
Numeric (0 or 1). Have you ever been arrested for driving under the influence of alcohol? (1 = Yes). |
history_hospitalization |
Numeric (0 or 1). Have you ever been in a hospital because of drinking? (1 = Yes). |
help_for_drinking |
Numeric (0 or 1). Have you ever gone to anyone for help about your drinking? (1 = Yes). |
lost_friends_girl_boy |
Numeric (0 or 1). Have you ever lost friends or girlfriends/boyfriends because of your drinking? (1 = Yes). |
Value
A list containing:
SMAST_Score |
The calculated total score (Range 0-13). |
Interpretation |
Classification (Low probability 0-1, Possible 2, Alcoholism >=3). |
References
Selzer ML, Vinokur A, van Rooijen L. A self-administered Short Michigan Alcoholism Screening Test (SMAST). J Stud Alcohol. 1975;36(1):117-126. doi:10.15288/jsa.1975.36.117
Examples
# Example 1: High Probability
# Guilty (1), Family complains (1), Shakes (1)
# Score = 3
short_mast_alcohol_screen(0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0)
# Example 2: Low Probability
# No affirmative responses
short_mast_alcohol_screen(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Shortened Modified Fatigue Impact Scale (MFIS-5)
Description
Calculates the score for the 5-item Shortened Modified Fatigue Impact Scale (MFIS-5). This tool assesses the impact of fatigue on physical, cognitive, and psychosocial functioning in patients with multiple sclerosis (MS). It is a subset of the full 21-item MFIS.
Usage
shortened_mfis_score(less_alert, limit_physical_tasks, sustain_physical_effort,
limit_clear_thinking, trouble_concentrating)
Arguments
less_alert |
Numeric (0-4). "I have been less alert." (0=Never, 4=Almost always). |
limit_physical_tasks |
Numeric (0-4). "I have been less able to complete tasks that require physical effort." (0=Never, 4=Almost always). |
sustain_physical_effort |
Numeric (0-4). "I have had trouble maintaining physical effort for long periods." (0=Never, 4=Almost always). |
limit_clear_thinking |
Numeric (0-4). "I have been less able to complete tasks that require clear thinking." (0=Never, 4=Almost always). |
trouble_concentrating |
Numeric (0-4). "I have had trouble concentrating." (0=Never, 4=Almost always). |
Details
The MFIS-5 consists of items 1, 9, 10, 17, and 19 from the full MFIS. Scoring for each item: 0 = Never 1 = Rarely 2 = Sometimes 3 = Often 4 = Almost always
Value
A list containing:
MFIS_5_Score |
The calculated total score (Range 0-20). |
Interpretation |
General interpretation of the score. |
References
Fisk JD, Ritvo PG, Ross L, et al. Measuring the functional impact of fatigue: initial validation of the fatigue impact scale. Clin Infect Dis. 1994;18 Suppl 1:S79-83. doi:10.1093/clinids/18.supplement_1.s79 Multiple Sclerosis Quality of Life Inventory (MSQLI). National Multiple Sclerosis Society.
Examples
# Example 1: Moderate Fatigue Impact
# Scores: 2, 3, 2, 1, 2
shortened_mfis_score(2, 3, 2, 1, 2)
# Example 2: Severe Fatigue Impact
# Scores: 4, 4, 3, 4, 3
shortened_mfis_score(4, 4, 3, 4, 3)
Sepsis-Induced Coagulopathy (SIC) Score
Description
Calculates the Sepsis-Induced Coagulopathy (SIC) score to identify patients with sepsis who are developing coagulopathy. This score serves as an early warning system for Disseminated Intravascular Coagulation (DIC) and is useful for selecting patients for anticoagulant therapy trials in sepsis.
Usage
sic_score(platelet_count, inr, sofa_total_score)
Arguments
platelet_count |
Numeric. Platelet count in x10^9/L. < 100: +2 pts. 100-150: +1 pt. >= 150: 0 pts. |
inr |
Numeric. International Normalized Ratio. > 1.4: +2 pts. > 1.2 - 1.4: +1 pt. <= 1.2: 0 pts. |
sofa_total_score |
Numeric. The total Sequential Organ Failure Assessment (SOFA) score. >= 2: +2 pts. 1: +1 pt. 0: 0 pts. |
Value
A list containing:
SIC_Score |
The calculated score (Range 0-6). |
Classification |
"Sepsis-Induced Coagulopathy (SIC)" if Score >= 4, otherwise "No SIC". |
References
Iba T, Nisio MD, Levy JH, et al. New criteria for sepsis-induced coagulopathy (SIC) following the revised sepsis definition: a poster-hoc analysis of the FACS trial. Crit Care. 2017;21:209. doi:10.1186/s13054-017-1790-7
Examples
# Example 1: SIC Present
# Plt 80 (2), INR 1.5 (2), SOFA 5 (2)
# Score = 6
sic_score(80, 1.5, 5)
# Example 2: No SIC
# Plt 160 (0), INR 1.1 (0), SOFA 3 (2)
# Score = 2
sic_score(160, 1.1, 3)
Secondary Intracerebral Hemorrhage (sICH) Score
Description
Calculates the sICH score to predict the likelihood of an underlying vascular etiology (e.g., AVM, aneurysm, fistula) in patients with non-traumatic intracerebral hemorrhage. The score guides the decision to perform further vascular imaging (CTA, MRA, or DSA).
Usage
sich_score(ncct_probability, age, sex, history_hypertension, impaired_coagulation)
Arguments
ncct_probability |
String. Assessment of vascular cause probability based on Non-Contrast CT. "high": Enlarged vessels, calcifications along margins, or venous sinus hyperattenuation (2 pts). "indeterminate": Unusual shape, edema disproportionate to time, or isolated subarachnoid hemorrhage (1 pt). "low": Typical deep/ganglionic hemorrhage without above features (0 pts). |
age |
Numeric. Patient age in years. 18-45: 2 pts. 46-70: 1 pt. >=71: 0 pts. |
sex |
String. "Male" (0 pts) or "Female" (1 pt). |
history_hypertension |
Numeric (0 or 1). History of hypertension. (0 = No, 1 = Yes). |
impaired_coagulation |
Numeric (0 or 1). Impaired coagulation (e.g., INR > 3, antiplatelet therapy). (0 = No, 1 = Yes). Note: The score adds 1 point if *neither* hypertension *nor* impaired coagulation is present. |
Value
A list containing:
sICH_Score |
The calculated score (Range 0-6). |
Risk_Probability |
Estimated probability of a vascular etiology. |
Recommendation |
Guidance on the need for vascular imaging. |
References
Delgado Almandoz JE, Schaefer PW, Goldstein JN, et al. Practical scoring system for the identification of patients with intracerebral hemorrhage at highest risk of harboring an underlying vascular etiology: the Secondary Intracerebral Hemorrhage Score. AJNR Am J Neuroradiol. 2010;31(9):1653-1660. doi:10.3174/ajnr.A2156
Examples
# Example 1: High Risk
# High NCCT probability (+2), 30yo (+2), Female (+1), No HTN/Coag (+1)
# Score = 6
sich_score("high", 30, "female", 0, 0)
# Example 2: Low Risk
# Low NCCT (0), 75yo (0), Male (0), History of HTN (0 pts for 'neither' condition)
# Score = 0
sich_score("low", 75, "male", 1, 0)
Sickle Cell RBC Exchange Volume Calculator
Description
Calculates the volume of replacement packed Red Blood Cells (pRBCs) required for an automated red cell exchange procedure (erythrocytapheresis) in patients with Sickle Cell Disease. The calculation estimates Total Blood Volume (TBV) using Nadler's formula and uses a logarithmic depletion model to determine the volume needed to reduce Hemoglobin S (HbS) to a specific target percentage.
Usage
sickle_cell_rbc_exchange(sex, height_cm, weight_kg, initial_hct_percent,
target_hct_percent, replacement_hct_percent,
initial_hbs_percent, target_hbs_percent)
Arguments
sex |
String. Patient sex ("Male" or "Female"). Used for Nadler's TBV formula. |
height_cm |
Numeric. Patient height in centimeters. |
weight_kg |
Numeric. Patient weight in kilograms. |
initial_hct_percent |
Numeric. Patient's initial hematocrit (%). |
target_hct_percent |
Numeric. Patient's desired target hematocrit at the end of the procedure (%). |
replacement_hct_percent |
Numeric. Hematocrit of the replacement pRBC units (%). Typically ranges from 60-80% depending on the additive solution (e.g., Adsol vs. CPDA-1). |
initial_hbs_percent |
Numeric. Initial percentage of Hemoglobin S (HbS). |
target_hbs_percent |
Numeric. Desired target percentage of Hemoglobin S (HbS) (e.g., 30%). |
Details
The Total Blood Volume (TBV) is calculated using Nadler's formula. The exchange volume is derived using the formula for continuous flow exchange:
V_{replace} = \frac{TBV \times Hct_{avg}}{Hct_{replace}} \times \ln\left(\frac{HbS_{initial}}{HbS_{target}}\right)
Where Hct_{avg} is the average of the initial and target hematocrit.
Value
A list containing:
Replacement_Volume_mL |
The estimated volume of donor RBCs required. |
Total_Blood_Volume_mL |
The estimated total blood volume of the patient. |
References
Nadler SB, Hidalgo JH, Bloch T. Prediction of blood volume in normal human adults. Surgery. 1962;51(2):224-232. Padmanabhan A, et al. Guidelines on the Use of Therapeutic Apheresis in Clinical Practice. J Clin Apher. 2019.
Examples
# Example 1: Adult Male, reducing HbS from 80% to 30%
# Height 180cm, Weight 80kg, Hct 30% -> 30%, Donor Hct 60%
sickle_cell_rbc_exchange("male", 180, 80, 30, 30, 60, 80, 30)
# Example 2: Female, target Hct higher than initial
# Height 165cm, Weight 60kg, Hct 25% -> 30%, Donor Hct 70%, HbS 90% -> 30%
sickle_cell_rbc_exchange("female", 165, 60, 25, 30, 70, 90, 30)
Simon Broome Diagnostic Criteria for Familial Hypercholesterolemia (FH)
Description
Evaluates the Simon Broome criteria to diagnose Familial Hypercholesterolemia (FH). The diagnosis is based on elevated cholesterol levels combined with physical signs (xanthomas), family history, or DNA evidence. A diagnosis can be "Definite FH" or "Possible FH".
Usage
simon_broome_fh_criteria(adult, total_cholesterol, ldl_cholesterol,
tendinous_xanthoma, fh_premature_chd,
fh_hypercholesterolemia, dna_mutation, units = "mg/dL")
Arguments
adult |
Numeric (0 or 1). Is the patient an adult (age > 16)? (1 = Yes). |
total_cholesterol |
Numeric. Total cholesterol level. |
ldl_cholesterol |
Numeric. LDL cholesterol level. |
tendinous_xanthoma |
Numeric (0 or 1). Presence of tendinous xanthoma in the patient or a 1st/2nd degree relative. (1 = Yes). |
fh_premature_chd |
Numeric (0 or 1). Family history of myocardial infarction (MI) at age < 60 in 1st degree relative or < 50 in 2nd degree relative. (1 = Yes). |
fh_hypercholesterolemia |
Numeric (0 or 1). Family history of elevated cholesterol (> 7.5 mmol/L) in 1st/2nd degree relative. (1 = Yes). |
dna_mutation |
Numeric (0 or 1). Evidence of a functional mutation in LDLR, APOB, or PCSK9 gene. (1 = Yes). |
units |
String. Units for cholesterol input. Options: "mg/dL" (default) or "mmol/L". |
Details
Cholesterol Thresholds: - Adult: Total Cholesterol > 7.5 mmol/L (290 mg/dL) or LDL > 4.9 mmol/L (190 mg/dL) - Child: Total Cholesterol > 6.7 mmol/L (260 mg/dL) or LDL > 4.0 mmol/L (155 mg/dL)
Diagnosis: - Definite FH: Cholesterol threshold met PLUS (Tendinous xanthoma OR DNA mutation). - Possible FH: Cholesterol threshold met PLUS (Family Hx of premature CHD OR Family Hx of hypercholesterolemia).
Value
A list containing:
Diagnosis |
The diagnostic classification (Definite FH, Possible FH, or Unlikely FH). |
Cholesterol_Met |
Boolean indicating if the cholesterol threshold was met. |
References
Scientific Steering Committee on behalf of the Simon Broome Register Group. Risk of fatal coronary heart disease in familial hypercholesterolaemia. BMJ. 1991;303(6807):893-896.
Examples
# Example 1: Definite FH (Adult)
# LDL 200 mg/dL (>190), Xanthoma present
simon_broome_fh_criteria(1, 300, 200, 1, 0, 0, 0)
# Example 2: Possible FH (Child)
# LDL 160 mg/dL (>155), Family Hx of high chol
simon_broome_fh_criteria(0, 270, 160, 0, 0, 1, 0)
Simplified Autoimmune Hepatitis (AIH) Score
Description
Calculates the Simplified AIH Score (2008) to aid in the diagnosis of Autoimmune Hepatitis. The score is based on four parameters: autoantibodies, IgG levels, liver histology, and the absence of viral hepatitis.
Usage
simplified_aih_score(ana_or_sma_titer, lkm_titer, sla_antibody_positive,
igg_level, igg_uln, liver_histology, viral_hepatitis_absent)
Arguments
ana_or_sma_titer |
String. Titer of ANA or SMA antibodies. Options: "none", ">=1:40", ">=1:80". |
lkm_titer |
String. Titer of LKM antibodies. Options: "none", ">=1:40". |
sla_antibody_positive |
Numeric (0 or 1). Presence of Soluble Liver Antigen (SLA) antibodies. (1 = Positive). |
igg_level |
Numeric. Patient's serum IgG level. |
igg_uln |
Numeric. Upper Limit of Normal for IgG level in the lab. |
liver_histology |
String. Histological findings. Options: "typical" (interface hepatitis, emperipolesis, rosettes), "compatible" (chronic hepatitis without all typical features), "atypical" (signs of another diagnosis). |
viral_hepatitis_absent |
Numeric (0 or 1). Absence of viral hepatitis markers (A, B, C). (1 = Yes, markers absent). |
Value
A list containing:
Simplified_AIH_Score |
The calculated total score (Range 0-8). |
Diagnosis |
Interpretation (Probable AIH >= 6, Definite AIH >= 7). |
References
Hennes EM, Zeniya M, Czaja AJ, et al. Simplified criteria for the diagnosis of autoimmune hepatitis. Hepatology. 2008;48(1):169-176. doi:10.1002/hep.22322
Examples
# Example 1: Definite AIH
# ANA >=1:80 (2), IgG >1.1x ULN (2), Typical Histology (2), No Viral Hep (2)
# Score = 8
simplified_aih_score(">=1:80", "none", 0, 1800, 1500, "typical", 1)
# Example 2: Probable AIH
# ANA >=1:40 (1), IgG Normal (0), Compatible Histology (1), No Viral Hep (2)
# Score = 4 (Not Diagnostic - Wait, calculation: 1+0+1+2 = 4. Correct.)
simplified_aih_score(">=1:40", "none", 0, 1000, 1500, "compatible", 1)
# Example 3: Probable AIH (Score 6)
# ANA >=1:40 (1), IgG >1.1x (2), Compatible (1), No Viral (2) -> 6
simplified_aih_score(">=1:40", "none", 0, 1800, 1500, "compatible", 1)
Simplified Motor Score (SMS)
Description
Calculates the Simplified Motor Score (SMS), a streamlined version of the Glasgow Coma Scale (GCS) that uses only the motor component to predict outcomes in traumatic brain injury. It has been shown to have similar diagnostic accuracy to the full GCS for predicting intubation, neurosurgical intervention, and mortality.
Usage
simplified_motor_score(motor_response)
Arguments
motor_response |
Numeric. The patient's best motor response. 2: Obeys commands. 1: Localizes pain. 0: Withdraws to pain or worse (Flexion, Extension, or None). |
Value
A list containing:
SMS_Score |
The input score (0-2). |
Risk_Classification |
Assessment of TBI severity risk (Low vs. High). |
References
Gill M, Windemuth R, Steele R, Green SM. A comparison of the Glasgow Coma Scale score to simplified alternative scores for the prediction of traumatic brain injury outcomes. Ann Emerg Med. 2005;45(1):37-42. doi:10.1016/j.annemergmed.2004.07.429
Examples
# Example 1: Patient obeys commands
# Score = 2 (Low Risk)
simplified_motor_score(2)
# Example 2: Patient only localizes pain
# Score = 1 (High Risk)
simplified_motor_score(1)
# Example 3: Decerebrate posturing (Extension)
# Score = 0 (High Risk)
simplified_motor_score(0)
Simplified Pulmonary Embolism Severity Index (sPESI)
Description
Calculates the Simplified PESI score to predict 30-day mortality in patients with confirmed pulmonary embolism (PE). The score uses 6 variables to stratify patients into Low Risk (score of 0) or High Risk (score >= 1), aiding in the decision for outpatient versus inpatient management.
Usage
simplified_pesi_score(age, cancer_history, chronic_cardiopulmonary_disease,
heart_rate, systolic_bp, oxygen_saturation)
Arguments
age |
Numeric. Patient age in years. (> 80 years adds 1 point). |
cancer_history |
Numeric (0 or 1). History of cancer. (1 = Yes, +1 point). |
chronic_cardiopulmonary_disease |
Numeric (0 or 1). History of chronic cardiopulmonary disease. (1 = Yes, +1 point). |
heart_rate |
Numeric. Heart rate in beats per minute. (>= 110 bpm adds 1 point). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. (< 100 mmHg adds 1 point). |
oxygen_saturation |
Numeric. Arterial oxyhemoglobin saturation (%). (< 90% adds 1 point). |
Value
A list containing:
sPESI_Score |
The calculated total score (Range 0-6). |
Risk_Category |
Classification (Low Risk = 0, High Risk >= 1). |
Est_30_Day_Mortality |
Estimated 30-day mortality risk percentage. |
Recommendation |
Suggested management strategy. |
References
Jiménez D, Aujesky D, Moores L, et al. Simplification of the pulmonary embolism severity index for prognostication in patients with acute symptomatic pulmonary embolism. Arch Intern Med. 2010;170(15):1383-1389. doi:10.1001/archinternmed.2010.199
Examples
# Example 1: Low Risk
# 50yo, No Hx, HR 80, SBP 120, SpO2 98%
# Score = 0
simplified_pesi_score(50, 0, 0, 80, 120, 98)
# Example 2: High Risk
# 85yo (+1), HR 115 (+1), No other factors
# Score = 2
simplified_pesi_score(85, 0, 0, 115, 120, 95)
Spinal Instability Neoplastic Score (SINS)
Description
Calculates the SINS score to assess spinal stability in patients with spinal neoplastic disease. The scale helps guide referrals to spinal surgeons by categorizing lesions as stable, indeterminate, or unstable based on six radiographic and clinical factors.
Usage
sins_spine_score(location, pain_type, bone_lesion_type, spinal_alignment,
vertebral_collapse, posterior_involvement)
Arguments
location |
String. Location of the lesion. "junctional": Occiput-C2, C7-T2, T11-L1, L5-S1 (3 pts). "mobile": C3-C6, L2-L4 (2 pts). "semirigid": T3-T10 (1 pt). "rigid": S2-S5 (0 pts). |
pain_type |
String. Assessment of pain. "mechanical": Pain with movement/upright, relieved by recumbency (3 pts). "occasional_non_mechanical": Pain not clearly mechanical (1 pt). "pain_free": No pain (0 pts). |
bone_lesion_type |
String. Radiographic appearance of the bone lesion. "lytic" (2 pts). "mixed": Lytic/Blastic (1 pt). "blastic" (0 pts). |
spinal_alignment |
String. Radiographic spinal alignment. "subluxation_translation": Present (4 pts). "de_novo_deformity": Kyphosis or scoliosis (2 pts). "normal" (0 pts). |
vertebral_collapse |
String. Degree of vertebral body collapse. "gt_50_percent": >50% collapse (3 pts). "lt_50_percent": <50% collapse (2 pts). "no_collapse_gt_50_involved": No collapse but >50% body involvement (1 pt). "none": None of the above (0 pts). |
posterior_involvement |
String. Involvement of posterolateral elements (pedicles, facets, spinous processes). "bilateral" (3 pts). "unilateral" (1 pt). "none" (0 pts). |
Value
A list containing:
SINS_Score |
The calculated total score (Range 0-18). |
Stability_Classification |
Classification (Stable 0-6, Indeterminate 7-12, Unstable 13-18). |
Recommendation |
Clinical guidance on surgical consultation. |
References
Fisher CG, DiPaola CP, Ryken TC, et al. A novel classification system for spinal instability in neoplastic disease: an evidence-based approach and expert consensus from the Spine Oncology Study Group. Spine. 2010;35(22):E1221-1229. doi:10.1097/BRS.0b013e3181e16ae2
Examples
# Example 1: Unstable
# Junctional (3), Mechanical Pain (3), Lytic (2),
#Subluxation (4), >50% Collapse (3), Bilateral Posterior (3)
# Score = 18
sins_spine_score("junctional", "mechanical", "lytic",
"subluxation_translation", "gt_50_percent", "bilateral")
# Example 2: Stable
# Rigid (0), Pain Free (0), Blastic (0), Normal (0), None (0), None (0)
# Score = 0
sins_spine_score("rigid", "pain_free", "blastic", "normal", "none", "none")
Shock Index, Pediatric Age-adjusted (SIPA)
Description
Calculates the Shock Index (Heart Rate / Systolic BP) and evaluates it against age-specific thresholds to identify blunt trauma patients at risk for severe injury. The SIPA score identifies children with early signs of shock who may have normal vital signs according to traditional reference ranges. Validated primarily for ages 4-16 years.
Usage
sipa_score(age_years, heart_rate, systolic_bp)
Arguments
age_years |
Numeric. Patient age in years. Validated range is 4 to 16 years. |
heart_rate |
Numeric. Heart rate in beats per minute. |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
Details
The Shock Index (SI) is calculated as SI = \frac{HR}{SBP}.
Elevated SIPA is defined as:
Ages 4-6: SI > 1.22
Ages 7-12: SI > 1.00
Ages 13-16: SI > 0.90
Value
A list containing:
Shock_Index |
The calculated shock index. |
SIPA_Outcome |
Interpretation of the result (Normal vs. Elevated). |
Age_Cutoff_Used |
The threshold applied based on the patient's age. |
References
Acker SN, Ross JT, Partrick DA, Tong S, Bensard DD. Pediatric specific shock index accurately identifies severely injured children. J Pediatr Surg. 2015;50(2):331-334. doi:10.1016/j.jpedsurg.2014.08.009 Acker SN, et al. Shock index, pediatric age-adjusted (SIPA) is more accurate than age-adjusted hypotension for identifying severely injured children. Surgery. 2017;161(4):803-809.
Examples
# Example 1: 5-year-old with elevated SIPA
# HR 130, SBP 100 -> SI = 1.30 (> 1.22)
sipa_score(5, 130, 100)
# Example 2: 10-year-old with normal SIPA
# HR 90, SBP 110 -> SI = 0.82 (<= 1.00)
sipa_score(10, 90, 110)
SIRS, Sepsis, and Septic Shock Criteria
Description
Evaluates patients for Systemic Inflammatory Response Syndrome (SIRS), Sepsis, Severe Sepsis, and Septic Shock based on the 1992/2001 Consensus Conference definitions. Diagnosis is hierarchical based on the number of SIRS criteria met, the presence of infection, organ dysfunction, and refractory hypotension.
Usage
sirs_sepsis_criteria(temperature_c, heart_rate, respiratory_rate, paco2_mmhg,
wbc_count, bands_percent, infection_suspected,
organ_dysfunction_hypotension, fluids_refractory_hypotension)
Arguments
temperature_c |
Numeric. Core temperature in degrees Celsius. (Abnormal: >38 or <36). |
heart_rate |
Numeric. Heart rate in beats per minute. (Abnormal: >90). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. (Abnormal: >20). Optional if PaCO2 is provided. |
paco2_mmhg |
Numeric. Partial pressure of carbon dioxide in arterial blood. (Abnormal: <32 mmHg). Optional if RR is provided. |
wbc_count |
Numeric. White Blood Cell count in x10^3/mm^3. (Abnormal: >12 or <4). |
bands_percent |
Numeric. Percentage of immature neutrophils (bands). (Abnormal: >10%). |
infection_suspected |
Numeric (0 or 1). Is there a suspected or confirmed source of infection? (1 = Yes). |
organ_dysfunction_hypotension |
Numeric (0 or 1). Is there evidence of end-organ dysfunction (e.g., creatinine >2.0, platelets <100k, bilirubin >2, INR >1.5) or hypotension (SBP < 90 mmHg or Lactate > 4 mmol/L)? (1 = Yes). |
fluids_refractory_hypotension |
Numeric (0 or 1). Is there hypotension persistent despite adequate fluid resuscitation? (1 = Yes). |
Value
A list containing:
Diagnosis |
The derived diagnosis (No SIRS, SIRS, Sepsis, Severe Sepsis, or Septic Shock). |
SIRS_Criteria_Met |
The number of SIRS criteria satisfied (0-4). |
References
Bone RC, Balk RA, Cerra FB, et al. Definitions for sepsis and organ failure and guidelines for the use of innovative therapies in sepsis. The ACCP/SCCM Consensus Conference Committee. American College of Chest Physicians/Society of Critical Care Medicine. Chest. 1992;101(6):1644-1655. doi:10.1378/chest.101.6.1644
Examples
# Example 1: Sepsis (2 SIRS + Infection)
sirs_sepsis_criteria(39.0, 100, 22, NA, 10.0, 5, 1, 0, 0)
# Example 2: Septic Shock (Sepsis + Refractory Hypotension)
sirs_sepsis_criteria(35.0, 110, 24, NA, 15.0, 0, 1, 1, 1)
6-Minute Walk Distance (6MWD) Reference Equations
Description
Calculates the predicted 6-Minute Walk Distance (6MWD) and the Lower Limit of Normal (LLN) for healthy adults based on the reference equations by Enright and Sherrill (1998). If the patient's actual walked distance is provided, it calculates the percent predicted and evaluates if the performance is below the LLN.
Usage
six_minute_walk_prediction(sex, age, height_cm, weight_kg, actual_distance_m = NULL)
Arguments
sex |
String. Patient sex ("Male" or "Female"). |
age |
Numeric. Patient age in years (Range 40-80 years in validation study, but applicable to adults). |
height_cm |
Numeric. Patient height in centimeters. |
weight_kg |
Numeric. Patient weight in kilograms. |
actual_distance_m |
Numeric (Optional). The actual distance walked by the patient in meters. If provided, the function returns % Predicted and an interpretation relative to the LLN. |
Value
A list containing:
Predicted_Distance_m |
The estimated distance a healthy individual of the same demographics should walk. |
Lower_Limit_Normal_m |
The threshold below which the distance is considered abnormal (5th percentile). |
Percent_Predicted |
Ratio of Actual to Predicted distance (if actual is provided). |
Interpretation |
"Below Lower Limit of Normal" or "Normal" (if actual is provided). |
References
Enright PL, Sherrill DL. Reference equations for the six-minute walk in healthy adults. Am J Respir Crit Care Med. 1998;158(5 Pt 1):1384-1387. doi:10.1164/ajrccm.158.5.9710086
Examples
# Example 1: Prediction only
# 65yo Male, 175cm, 80kg
six_minute_walk_prediction("male", 65, 175, 80)
# Example 2: With Actual Distance
# 60yo Female, 160cm, 70kg, walked 400 meters
six_minute_walk_prediction("female", 60, 160, 70, actual_distance_m = 400)
Systemic Lupus Erythematosus Disease Activity Index 2000 (SLEDAI-2K)
Description
Calculates the SLEDAI-2K score to assess global disease activity in patients with Systemic Lupus Erythematosus (SLE). It assesses the presence of 24 specific clinical and laboratory variables over the last 10 days (or since the last visit).
Usage
sledai_2k_score(seizure, psychosis, organic_brain_syndrome, visual_disturbance,
cranial_nerve_disorder, lupus_headache, cva, vasculitis,
arthritis, myositis, urinary_casts, hematuria, proteinuria,
pyuria, rash, alopecia, mucosal_ulcers, pleurisy, pericarditis,
low_complement, increased_dna_binding, fever, thrombocytopenia,
leukopenia)
Arguments
seizure |
Numeric (0 or 1). Recent onset of seizure. (1 = Yes, 8 points). |
psychosis |
Numeric (0 or 1). Altered ability to function in normal activity due to severe disturbance in the perception of reality. (1 = Yes, 8 points). |
organic_brain_syndrome |
Numeric (0 or 1). Altered mental function with impaired orientation, memory, or other intellectual function. (1 = Yes, 8 points). |
visual_disturbance |
Numeric (0 or 1). Retinal changes of SLE. (1 = Yes, 8 points). |
cranial_nerve_disorder |
Numeric (0 or 1). New onset of sensory or motor neuropathy involving cranial nerves. (1 = Yes, 8 points). |
lupus_headache |
Numeric (0 or 1). Severe, persistent headache. (1 = Yes, 8 points). |
cva |
Numeric (0 or 1). New onset of cerebrovascular accident (CVA). (1 = Yes, 8 points). |
vasculitis |
Numeric (0 or 1). Ulceration, gangrene, tender finger nodules, periungual infarction, splinter hemorrhages, or biopsy/angiogram proof. (1 = Yes, 8 points). |
arthritis |
Numeric (0 or 1). More than 2 joints with pain and signs of inflammation (i.e., tenderness, swelling, or effusion). (1 = Yes, 4 points). |
myositis |
Numeric (0 or 1). Proximal muscle aching/weakness, associated with elevated CPK/aldolase or EMG changes or biopsy. (1 = Yes, 4 points). |
urinary_casts |
Numeric (0 or 1). Heme-granular or red blood cell casts. (1 = Yes, 4 points). |
hematuria |
Numeric (0 or 1). >5 red blood cells/high power field. (1 = Yes, 4 points). |
proteinuria |
Numeric (0 or 1). >0.5g/24 hours. (1 = Yes, 4 points). |
pyuria |
Numeric (0 or 1). >5 white blood cells/high power field. (1 = Yes, 4 points). |
rash |
Numeric (0 or 1). Inflammatory type rash. (1 = Yes, 2 points). |
alopecia |
Numeric (0 or 1). Abnormal, patchy or diffuse loss of hair. (1 = Yes, 2 points). |
mucosal_ulcers |
Numeric (0 or 1). Oral or nasal ulceration. (1 = Yes, 2 points). |
pleurisy |
Numeric (0 or 1). Pleuritic chest pain with pleural rub or effusion or pleural thickening. (1 = Yes, 2 points). |
pericarditis |
Numeric (0 or 1). Pericardial pain with rub or effusion or EKG confirmation. (1 = Yes, 2 points). |
low_complement |
Numeric (0 or 1). Decrease in CH50, C3, or C4 below the lower limit of normal. (1 = Yes, 2 points). |
increased_dna_binding |
Numeric (0 or 1). Increased DNA binding by Farr assay (above normal). (1 = Yes, 2 points). |
fever |
Numeric (0 or 1). >38 degrees C. (1 = Yes, 1 point). |
thrombocytopenia |
Numeric (0 or 1). <100,000 platelets/mm^3. (1 = Yes, 1 point). |
leukopenia |
Numeric (0 or 1). <3,000 white blood cells/mm^3. (1 = Yes, 1 point). |
Value
A list containing:
SLEDAI_2K_Score |
The calculated total score. |
Disease_Activity |
Interpretation of the score (No Activity, Mild, Moderate, High, Very High). |
References
Gladman DD, Ibañez D, Urowitz MB. Systemic lupus erythematosus disease activity index 2000. J Rheumatol. 2002;29(2):288-291.
Examples
# Example 1: Moderate Activity
# Arthritis (4), Rash (2), Fever (1)
# Score = 7
sledai_2k_score(0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0)
# Example 2: High Activity
# Vasculitis (8), Low Complement (2), Increased DNA Binding (2)
# Score = 12
sledai_2k_score(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0)
SLICC Criteria for Systemic Lupus Erythematosus (SLE)
Description
Evaluates the 2012 SLICC (Systemic Lupus International Collaborating Clinics) criteria for the diagnosis of Systemic Lupus Erythematosus. Diagnosis requires either: 1) Biopsy-proven lupus nephritis with positive ANA or Anti-dsDNA, OR 2) At least 4 criteria met, including at least one clinical criterion and one immunologic criterion.
Usage
slicc_sle_criteria(acute_cutaneous_lupus, chronic_cutaneous_lupus, oral_ulcers,
alopecia, synovitis, serositis, renal_clinical, neurologic,
hemolytic_anemia, leukopenia_lymphopenia, thrombocytopenia,
ana, anti_dsdna, anti_sm, antiphospholipid_antibody,
low_complement, direct_coombs, biopsy_proven_nephritis)
Arguments
acute_cutaneous_lupus |
Numeric (0/1). Presence of acute cutaneous lupus (e.g., malar rash). |
chronic_cutaneous_lupus |
Numeric (0/1). Presence of chronic cutaneous lupus (e.g., discoid rash). |
oral_ulcers |
Numeric (0/1). Oral or nasal ulcers. |
alopecia |
Numeric (0/1). Non-scarring alopecia. |
synovitis |
Numeric (0/1). Synovitis involving 2 or more joints. |
serositis |
Numeric (0/1). Serositis (pleuritis or pericarditis). |
renal_clinical |
Numeric (0/1). Renal criteria (urine protein/creatinine ratio or red blood cell casts). |
neurologic |
Numeric (0/1). Neurologic criteria (seizures, psychosis, etc.). |
hemolytic_anemia |
Numeric (0/1). Hemolytic anemia. |
leukopenia_lymphopenia |
Numeric (0/1). Leukopenia (<4000/mm3) or Lymphopenia (<1000/mm3). |
thrombocytopenia |
Numeric (0/1). Thrombocytopenia (<100,000/mm3). |
ana |
Numeric (0/1). Positive ANA (Antinuclear Antibody). |
anti_dsdna |
Numeric (0/1). Positive Anti-dsDNA. |
anti_sm |
Numeric (0/1). Positive Anti-Sm. |
antiphospholipid_antibody |
Numeric (0/1). Positive Antiphospholipid antibody. |
low_complement |
Numeric (0/1). Low complement (C3, C4, or CH50). |
direct_coombs |
Numeric (0/1). Positive Direct Coombs test. (Note: Counts as immunologic criterion only in the absence of hemolytic anemia). |
biopsy_proven_nephritis |
Numeric (0/1). Biopsy-proven lupus nephritis. |
Value
A list containing:
Diagnosis |
"Systemic Lupus Erythematosus (SLE)" or "Criteria Not Met". |
Total_Criteria_Met |
Count of total criteria met (adjusted for Coombs rule). |
Breakdown |
Breakdown of Clinical and Immunologic counts. |
References
Petri M, Orbai AM, Alarcón GS, et al. Derivation and validation of the Systemic Lupus International Collaborating Clinics classification criteria for systemic lupus erythematosus. Arthritis Rheum. 2012;64(8):2677-2686. doi:10.1002/art.34473
Examples
# Example 1: Diagnosis via Criteria Count
# Malar rash (1), Arthritis (1), Renal (1), ANA (1) -> 3 Clinical, 1 Immuno, Total 4
slicc_sle_criteria(1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0)
# Example 2: Diagnosis via Biopsy
# No clinical symptoms, but Biopsy Nephritis (1) and ANA (1)
slicc_sle_criteria(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1)
Subaxial Cervical Spine Injury Classification System (SLICS)
Description
Calculates the SLICS score to guide the management (operative vs. non-operative) of subaxial cervical spine injuries (C3-C7). The score is based on three main categories: injury morphology, discoligamentous complex (DLC) integrity, and neurological status.
Usage
slics_spine_score(morphology, dlc_status, neurologic_status,
continuous_compression = 0)
Arguments
morphology |
String. The morphology of the injury. Options: "no_abnormality": 0 pts. "compression": 1 pt. "burst": 2 pts. "distraction": 3 pts (e.g., facet perch, hyperextension). "translation_rotation": 4 pts (e.g., facet dislocation, unstable teardrop). |
dlc_status |
String. Status of the Discoligamentous Complex (DLC). Options: "intact": 0 pts. "indeterminate": 1 pt (e.g., isolated interspinous widening, MRI signal change only). "disrupted": 2 pts (e.g., facet perch/dislocation, wide separation). |
neurologic_status |
String. Neurological status of the patient. Options: "intact": 0 pts. "root_injury": 1 pt. "complete_cord": 2 pts. "incomplete_cord": 3 pts. |
continuous_compression |
Numeric (0 or 1). Is there continuous cord compression in the setting of a neurologic deficit? (1 = Yes, +1 point). |
Value
A list containing:
SLICS_Score |
The calculated total score (Range 0-10+). |
Management_Recommendation |
Clinical guidance based on the score (Non-Operative < 4, Indeterminate = 4, Operative > 4). |
References
Vaccaro AR, Hulbert RJ, Patel AA, et al. The subaxial cervical spine injury classification system: a novel approach to recognize the importance of morphology, neurology, and integrity of the disco-ligamentous complex. Spine (Phila Pa 1976). 2007;32(21):2365-2374. doi:10.1097/BRS.0b013e3181557b92
Examples
# Example 1: Non-Operative
# Burst fracture (2), Intact DLC (0), Intact Neuro (0)
# Score = 2
slics_spine_score("burst", "intact", "intact")
# Example 2: Operative
# Distraction (3), Disrupted DLC (2), Incomplete Cord (3)
# Score = 8
slics_spine_score("distraction", "disrupted", "incomplete_cord")
SMART-COP Score for Pneumonia Severity
Description
Calculates the SMART-COP score to predict the need for Intensive Respiratory or Vasopressor Support (IRVS) in patients with Community-Acquired Pneumonia (CAP). The score incorporates Systolic BP, Multilobar chest radiography, Albumin, Respiratory rate, Tachycardia, Confusion, Oxygenation, and pH levels, with age-adjusted cutoffs for respiratory rate and oxygenation.
Usage
smart_cop_score(age, systolic_bp, multilobar_cxr, albumin_g_dl,
respiratory_rate, heart_rate, confusion, arterial_ph,
pao2_mmhg = NA, spo2_percent = NA, pao2_fio2_ratio = NA)
Arguments
age |
Numeric. Patient age in years. |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. (< 90 mmHg adds 2 points). |
multilobar_cxr |
Numeric (0 or 1). Multilobar involvement on chest radiograph. (1 = Yes, +1 point). |
albumin_g_dl |
Numeric. Serum albumin in g/dL. (< 3.5 g/dL adds 1 point). |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. (Age <= 50: >= 25 adds 1 point; Age > 50: >= 30 adds 1 point). |
heart_rate |
Numeric. Heart rate in beats per minute. (>= 125 bpm adds 1 point). |
confusion |
Numeric (0 or 1). New onset confusion. (1 = Yes, +1 point). |
arterial_ph |
Numeric. Arterial pH. (< 7.35 adds 2 points). |
pao2_mmhg |
Numeric (Optional). Arterial partial pressure of oxygen. Used for oxygenation scoring. |
spo2_percent |
Numeric (Optional). Oxygen saturation percentage. Used for oxygenation scoring. |
pao2_fio2_ratio |
Numeric (Optional). PaO2/FiO2 ratio. Used for oxygenation scoring. Note: Low oxygenation adds 2 points. Thresholds depend on age (<= 50: PaO2 < 70, SpO2 <= 93, P/F < 333; > 50: PaO2 < 60, SpO2 <= 90, P/F < 250). |
Value
A list containing:
SMART_COP_Score |
The calculated total score (Range 0-11). |
Risk_Category |
Classification (Low, Moderate, High, Very High). |
Prediction |
Estimated risk of needing IRVS. |
References
Charles PG, Wolfe R, Whitby M, et al. SMART-COP: a tool for predicting the need for intensive respiratory or vasopressor support in community-acquired pneumonia. Clin Infect Dis. 2008;47(3):375-384. doi:10.1086/589754
Examples
# Example 1: High Risk
# 45yo, SBP 85 (+2), Multilobar (+1), Alb 3.0 (+1),
#RR 30 (+1), HR 110 (0), Conf (0), Low O2 (+2), pH 7.30 (+2)
# Score = 9
smart_cop_score(45, 85, 1, 3.0, 30, 110, 0, 7.30, spo2_percent = 88)
# Example 2: Low Risk
# 60yo, SBP 120, Unilobar, Alb 4.0, RR 20, HR 80, Alert, Normal O2/pH
# Score = 0
smart_cop_score(60, 120, 0, 4.0, 20, 80, 0, 7.40, spo2_percent = 98)
Short Michigan Alcoholism Screening Test - Geriatric Version (SMAST-G)
Description
Calculates the SMAST-G score, a 10-item screening tool specifically designed to identify alcohol problems in older adults. A score of 2 or more is generally considered a positive screen indicative of potential alcohol abuse.
Usage
smast_g_score(underestimate_drinking, skip_meals, decrease_shakes, memory_loss,
drink_to_relax, drink_to_forget_problems, increase_after_loss,
doctor_concerned, make_rules, drink_when_lonely)
Arguments
underestimate_drinking |
Numeric (0 or 1). When talking with others, do you ever underestimate how much you drink? (1 = Yes). |
skip_meals |
Numeric (0 or 1). After a few drinks, have you sometimes not eaten or been able to skip a meal because you didn't feel hungry? (1 = Yes). |
decrease_shakes |
Numeric (0 or 1). Does having a few drinks help decrease your shakiness or tremors? (1 = Yes). |
memory_loss |
Numeric (0 or 1). Does alcohol sometimes make it hard for you to remember parts of the day or night? (1 = Yes). |
drink_to_relax |
Numeric (0 or 1). Do you usually take a drink to relax or calm your nerves? (1 = Yes). |
drink_to_forget_problems |
Numeric (0 or 1). Do you drink to take your mind off your major problems? (1 = Yes). |
increase_after_loss |
Numeric (0 or 1). Have you ever increased your drinking after experiencing a loss in your life? (1 = Yes). |
doctor_concerned |
Numeric (0 or 1). Has a doctor or nurse ever said they were worried or concerned about your drinking? (1 = Yes). |
make_rules |
Numeric (0 or 1). Have you ever made rules to manage your drinking? (1 = Yes). |
drink_when_lonely |
Numeric (0 or 1). When you feel lonely, does having a drink help? (1 = Yes). |
Value
A list containing:
SMAST_G_Score |
The calculated total score (Range 0-10). |
Result |
Interpretation of the screen (Positive/Negative). |
References
Blow FC, Brower KJ, Schulenberg JE, et al. The Short Michigan Alcoholism Screening Test - Geriatric Version (SMAST-G): a new elderly-specific screening instrument. Alcohol Clin Exp Res. 1992.
Examples
# Example 1: Positive Screen
# Drinks to relax (1), Doctor concerned (1), Lonely (1)
# Score = 3
smast_g_score(0, 0, 0, 0, 1, 0, 0, 1, 0, 1)
# Example 2: Negative Screen
# No affirmative responses
# Score = 0
smast_g_score(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Sodium Correction for Hyperglycemia
Description
Calculates the corrected serum sodium level in the presence of hyperglycemia. High blood glucose draws water from the intracellular space into the extracellular space, diluting the serum sodium (translocational hyponatremia). Correcting the sodium concentration helps determine if the patient is truly hyponatremic, eunatremic, or hypernatremic.
Usage
sodium_correction_hyperglycemia(measured_sodium, glucose,
glucose_units = "mg/dL", correction_factor = 1.6)
Arguments
measured_sodium |
Numeric. The measured serum sodium level in mEq/L or mmol/L. |
glucose |
Numeric. The measured serum glucose level. |
glucose_units |
String. Units for glucose input. Options: "mg/dL" (default) or "mmol/L". |
correction_factor |
Numeric. The factor used to correct sodium for every 100 mg/dL rise in glucose above 100 mg/dL. Defaults to 1.6 (Katz formula). Another common value is 2.4 (Hillier formula), which may be more accurate for glucose levels > 400 mg/dL. |
Value
A list containing:
Corrected_Sodium |
The estimated serum sodium concentration if glucose were normal. |
References
Katz MA. Hyperglycemia-induced hyponatremia–calculation of expected serum sodium depression. N Engl J Med. 1973;289(16):843-844. doi:10.1056/NEJM197310182891607 Hillier TA, Abbott RD, Barrett EJ. Hyponatremia: evaluating the correction factor for hyperglycemia. Am J Med. 1999;106(4):399-403. doi:10.1016/s0002-9343(99)00005-2
Examples
# Example 1: DKA with glucose 600 mg/dL
# Measured Na 128, Glucose 600, using Katz (1.6)
# Correction = 1.6 * ((600-100)/100) = 1.6 * 5 = 8
# Corrected Na = 128 + 8 = 136
sodium_correction_hyperglycemia(128, 600)
# Example 2: Using Hillier factor (2.4) for severe hyperglycemia
# Measured Na 130, Glucose 800
# Correction = 2.4 * 7 = 16.8 -> Corrected ~146.8
sodium_correction_hyperglycemia(130, 800, correction_factor = 2.4)
Sodium Correction Rate in Hyponatremia/Hypernatremia (Adrogue-Madias)
Description
Calculates the infusion rate of a selected fluid required to correct serum sodium to a target level over a specified time. Uses the Adrogue-Madias formula to estimate the change in serum sodium per liter of infusate.
Usage
sodium_correction_rate(current_sodium, target_sodium, time_hours,
fluid_sodium, weight_kg, percent_body_water = 0.5)
Arguments
current_sodium |
Numeric. Current serum sodium level (mEq/L). |
target_sodium |
Numeric. Desired target serum sodium level (mEq/L). |
time_hours |
Numeric. Duration over which to achieve the target (hours). |
fluid_sodium |
Numeric. Sodium content of the infusate (mEq/L). (e.g., 3% NaCl = 513, 0.9% NaCl = 154, D5W = 0). |
weight_kg |
Numeric. Patient weight in kilograms. |
percent_body_water |
Numeric. Fraction of total body water (e.g., 0.6 for men, 0.5 for women/elderly men, 0.45 for elderly women). Defaults to 0.5. |
Details
The formula for the change in serum Na per liter of fluid is:
\Delta Na = \frac{Fluid Na - Serum Na}{TBW + 1}
The volume required is:
Volume (L) = \frac{Target Na - Current Na}{\Delta Na}
Value
A list containing:
Infusion_Rate_mL_hr |
The calculated infusion rate in mL/hr. |
Total_Volume_L |
Total volume required to reach target. |
Change_In_Serum_Na_per_L_Infusate |
Estimated change in serum Na for every 1L infused. |
References
Adrogue HJ, Madias NE. Hyponatremia. N Engl J Med. 2000;342(21):1581-1589. doi:10.1056/NEJM200005253422107
Examples
# Example 1: Hyponatremia correction
# Na 115 -> 120 in 24h, using 3% Saline (513 mEq/L), 70kg Male (0.6 TBW)
sodium_correction_rate(115, 120, 24, 513, 70, 0.6)
# Example 2: Hypernatremia correction
# Na 155 -> 150 in 24h, using D5W (0 mEq/L), 60kg Elderly Woman (0.45 TBW)
sodium_correction_rate(155, 150, 24, 0, 60, 0.45)
Sodium Deficit Calculator for Hyponatremia
Description
Calculates the total sodium deficit in milliequivalents (mEq) required to raise the serum sodium concentration to a specified target level. The calculation estimates Total Body Water (TBW) based on the patient's sex, age category (adult, elderly, child), and weight.
Usage
sodium_deficit_hyponatremia(current_sodium, target_sodium, weight_kg, sex,
patient_type = "adult")
Arguments
current_sodium |
Numeric. Current serum sodium level (mEq/L). |
target_sodium |
Numeric. Desired target serum sodium level (mEq/L). Note: Correction should generally not exceed 8-12 mEq/L in 24 hours to avoid osmotic demyelination syndrome. |
weight_kg |
Numeric. Patient weight in kilograms. |
sex |
String. Patient sex ("Male" or "Female"). |
patient_type |
String. Patient age category to determine TBW fraction. "adult": Male 0.6, Female 0.5. "elderly": Male 0.5, Female 0.45. "child": 0.6 (Both sexes). |
Details
The formula used is:
Sodium Deficit (mEq) = TBW \times (Target Na - Current Na)
Where TBW is estimated as a fraction of body weight based on the selected category.
Value
A list containing:
Sodium_Deficit_mEq |
The estimated amount of sodium required to reach the target level. |
Total_Body_Water_L |
The estimated Total Body Water. |
References
Adrogué HJ, Madias NE. Hyponatremia. N Engl J Med. 2000;342(21):1581-1589. doi:10.1056/NEJM200005253422107
Examples
# Example 1: Adult Male, Na 120 to 125
# TBW = 0.6 * 70 = 42 L
# Deficit = 42 * (125 - 120) = 210 mEq
sodium_deficit_hyponatremia(120, 125, 70, "male", "adult")
# Example 2: Elderly Female, Na 115 to 120
# TBW = 0.45 * 60 = 27 L
# Deficit = 27 * (120 - 115) = 135 mEq
sodium_deficit_hyponatremia(115, 120, 60, "female", "elderly")
Sequential Organ Failure Assessment (SOFA) Score
Description
Calculates the SOFA score to track a patient's status during their stay in an intensive care unit (ICU). The score determines the extent of a person's organ function or rate of failure. It is based on six different scores, one each for the respiratory, cardiovascular, hepatic, coagulation, renal, and neurological systems.
Usage
sofa_score(pao2, fio2, mechanical_ventilation, platelets, bilirubin,
mean_arterial_pressure, vasopressor_level, gcs, creatinine)
Arguments
pao2 |
Numeric. Partial pressure of oxygen in arterial blood (mmHg). |
fio2 |
Numeric. Fraction of inspired oxygen (0.21 - 1.0 or 21 - 100). |
mechanical_ventilation |
Numeric (0 or 1). Is the patient on mechanical ventilation? (1 = Yes). |
platelets |
Numeric. Platelet count in x10^3/uL. |
bilirubin |
Numeric. Total bilirubin in mg/dL. |
mean_arterial_pressure |
Numeric. Mean Arterial Pressure in mmHg. |
vasopressor_level |
String. Level of vasopressor support. "none": No vasopressors. "low": Dopamine <= 5 or Dobutamine (any dose). "medium": Dopamine > 5, Epinephrine <= 0.1, or Norepinephrine <= 0.1. "high": Dopamine > 15, Epinephrine > 0.1, or Norepinephrine > 0.1. |
gcs |
Numeric. Glasgow Coma Scale score (3-15). |
creatinine |
Numeric. Serum creatinine in mg/dL. |
Value
A list containing:
SOFA_Score |
The total calculated SOFA score (Range 0-24). |
Mortality_Estimate |
Approximate in-hospital mortality risk based on initial score. |
Organ_Scores |
A breakdown of scores for each organ system. |
References
Vincent JL, Moreno R, Takala J, et al. The SOFA (Sepsis-related Organ Failure Assessment) score to describe organ dysfunction/failure. On behalf of the Working Group on Sepsis-Related Problems of the European Society of Intensive Care Medicine. Intensive Care Med. 1996;22(7):707-710. doi:10.1007/bf01709751
Examples
sofa_score(80, 40, 1, 120, 1.5, 65, "medium", 13, 2.2)
Sokal Index for Chronic Myelogenous Leukemia (CML)
Description
Calculates the Sokal Index to prognosticate risk in patients with Chronic Myelogenous Leukemia (CML). The score is based on age, spleen size, platelet count, and percentage of blasts in the peripheral blood. It stratifies patients into Low, Intermediate, or High risk groups regarding survival.
Usage
sokal_cml_index(age, spleen_size_cm, platelet_count, blasts_percent)
Arguments
age |
Numeric. Patient age in years. |
spleen_size_cm |
Numeric. Spleen size in centimeters below the costal margin (0 if not palpable). |
platelet_count |
Numeric. Platelet count in x10^9/L (e.g., 300 for 300,000/uL). |
blasts_percent |
Numeric. Percentage of blasts in peripheral blood. |
Value
A list containing:
Sokal_Score |
The calculated relative risk score. |
Risk_Group |
Risk classification (Low < 0.8, Intermediate 0.8-1.2, High > 1.2). |
References
Sokal JE, Cox EB, Baccarani M, et al. Prognostic discrimination in "good-risk" chronic granulocytic leukemia. Blood. 1984;63(4):789-799.
Examples
# Example 1: Low Risk
# 35yo, Spleen 0cm, Plt 300, Blasts 1%
# Score approx 0.6
sokal_cml_index(35, 0, 300, 1)
# Example 2: High Risk
# 60yo, Spleen 10cm, Plt 700, Blasts 5%
# Score > 1.2
sokal_cml_index(60, 10, 700, 5)
SSIGN Score for Renal Cell Carcinoma (RCC)
Description
Calculates the SSIGN (Stage, Size, Grade, and Necrosis) Score to predict cancer-specific survival outcomes in patients with clear cell Renal Cell Carcinoma (ccRCC) after radical or partial nephrectomy.
Usage
ssign_rcc_score(pathologic_t_stage, lymph_node_status, metastasis_status,
tumor_size_ge_5cm, fuhrman_grade, tumor_necrosis_present)
Arguments
pathologic_t_stage |
String. Pathologic T Stage (2002 TNM). "t1a": 0 pts. "t1b": 2 pts. "t2": 3 pts. "t3a", "t3b", "t3c": 4 pts. "t4": 5 pts. |
lymph_node_status |
String. Regional Lymph Node status. "n0" or "nx": 0 pts. "n1" or "n2": 2 pts. |
metastasis_status |
Numeric (0 or 1). Distant metastasis (M1). (1 = Yes, +4 pts). |
tumor_size_ge_5cm |
Numeric (0 or 1). Tumor size >= 5 cm. (1 = Yes, +2 pts). |
fuhrman_grade |
Numeric (1-4). Fuhrman Nuclear Grade. 1 or 2: 0 pts. 3: 1 pt. 4: 3 pts. |
tumor_necrosis_present |
Numeric (0 or 1). Presence of tumor necrosis. (1 = Yes, +2 pts). |
Value
A list containing:
SSIGN_Score |
The calculated total score (Range 0-18). |
Est_5_Year_Survival |
Estimated 5-year cancer-specific survival percentage. |
References
Frank I, Blute ML, Cheville JC, et al. An outcome prediction model for patients with clear cell renal cell carcinoma treated with radical nephrectomy based on tumor stage, size, grade and necrosis: the SSIGN score. J Urol. 2002;168(6):2395-2400. doi:10.1016/S0022-5347(05)64153-5
Examples
# Example 1: High Risk
# T3a (+4), N0 (0), M0 (0), Size 6cm (+2), Grade 4 (+3), Necrosis (+2)
# Score = 11
ssign_rcc_score("t3a", "n0", 0, 1, 4, 1)
# Example 2: Low Risk
# T1a (0), N0 (0), M0 (0), Size 3cm (0), Grade 2 (0), No Necrosis (0)
# Score = 0
ssign_rcc_score("t1a", "n0", 0, 0, 2, 0)
Stanford Sleepiness Scale (SSS)
Description
Retrieves the description and interpretation for the Stanford Sleepiness Scale (SSS) score. The SSS is a self-rating scale used to quantify a person's current level of alertness or sleepiness at a specific moment in time.
Usage
stanford_sleepiness_scale(alertness_level)
Arguments
alertness_level |
Numeric (1-7). The selected rating corresponding to the patient's current state. 1: Feeling active, vital, alert, or wide awake 2: Functioning at high levels, but not at peak; able to concentrate 3: Awake, but relaxed; responsive but not fully alert 4: Somewhat foggy, let down 5: Foggy; losing interest in remaining awake; slowed down 6: Sleepy, woozy, fighting sleep; prefer to lie down 7: No longer fighting sleep, sleep onset soon; having dream-like thoughts |
Value
A list containing:
SSS_Score |
The input score. |
Description |
The specific descriptor associated with the score. |
Interpretation |
General classification (Alert/Normal vs. Sleepy/Fatigued). |
References
Hoddes E, Zarcone V, Smythe H, Phillips R, Dement WC. Quantification of sleepiness: a new approach. Psychophysiology. 1973;10(4):431-436. doi:10.1111/j.1469-8986.1973.tb00801.x
Examples
# Example 1: Alert
stanford_sleepiness_scale(2)
# Example 2: Sleepy
stanford_sleepiness_scale(6)
Static Lung Compliance (Cstat) Calculator
Description
Calculates the Static Lung Compliance (Cstat) of a mechanically ventilated patient. Static compliance represents the distensibility of the lungs and chest wall when there is no airflow (static conditions). It is calculated using the tidal volume, plateau pressure, and positive end-expiratory pressure (PEEP).
Usage
static_lung_compliance(tidal_volume, plateau_pressure, peep)
Arguments
tidal_volume |
Numeric. The exhaled tidal volume in milliliters (mL). |
plateau_pressure |
Numeric. The plateau pressure (Pplat) measured during an inspiratory pause in cmH2O. |
peep |
Numeric. The Positive End-Expiratory Pressure (PEEP) in cmH2O. |
Details
The formula used is:
C_{stat} = \frac{V_T}{P_{plat} - PEEP}
Where:
-
C_{stat}is Static Compliance (mL/cmH2O) -
V_Tis Tidal Volume (mL) -
P_{plat}is Plateau Pressure (cmH2O) -
PEEPis Positive End-Expiratory Pressure (cmH2O)
Normal static compliance in intubated patients is typically 50-80 mL/cmH2O. Values < 30 mL/cmH2O are often seen in severe ARDS.
Value
A list containing:
Static_Compliance_mL_cmH2O |
The calculated static lung compliance. |
Interpretation |
Clinical interpretation of the compliance value. |
References
Suter PM, Fairley B, Isenberg MD. Optimum end-expiratory airway pressure in patients with acute pulmonary failure. N Engl J Med. 1975;292(6):284-289. doi:10.1056/NEJM197502062920604
Examples
# Example 1: Normal Compliance
# Vt 500 mL, Pplat 15 cmH2O, PEEP 5 cmH2O
# Cstat = 500 / (15 - 5) = 50 mL/cmH2O
static_lung_compliance(500, 15, 5)
# Example 2: Low Compliance (ARDS)
# Vt 400 mL, Pplat 25 cmH2O, PEEP 10 cmH2O
# Cstat = 400 / (25 - 10) = 26.7 mL/cmH2O
static_lung_compliance(400, 25, 10)
Steinhart Model for Acute Heart Failure (AHF)
Description
Calculates the post-test probability of Acute Heart Failure in patients presenting with undifferentiated dyspnea. The model integrates the clinician's pre-test probability assessment with patient age and NT-proBNP levels to improve diagnostic accuracy.
Usage
steinhart_ahf_model(age, pretest_probability_percent, nt_probnp_pg_ml)
Arguments
age |
Numeric. Patient age in years. |
pretest_probability_percent |
Numeric. Clinician's estimated pre-test probability of AHF (0-100%), based on history, physical exam, ECG, and chest X-ray, before NT-proBNP results are known. |
nt_probnp_pg_ml |
Numeric. Serum N-terminal pro-B-type natriuretic peptide level in pg/mL. |
Value
A list containing:
PostTest_Probability |
The calculated probability of AHF diagnosis. |
Interpretation |
Risk categorization (Low <= 20%, Intermediate 21-79%, High >= 80%). |
References
Steinhart B, Thorpe KE, Bayoumi AM, et al. Improving the diagnosis of acute heart failure using a validated prediction model. J Am Coll Cardiol. 2012;60(16):1532-1539. doi:10.1016/j.jacc.2012.06.038
Examples
# Example 1: High Probability
# 75yo, Pretest 60%, NT-proBNP 4000
steinhart_ahf_model(75, 60, 4000)
# Example 2: Low Probability
# 50yo, Pretest 20%, NT-proBNP 100
steinhart_ahf_model(50, 20, 100)
Step-by-Step Approach for Febrile Infants
Description
Calculates the risk stratification for Invasive Bacterial Infection (IBI) in febrile infants (typically <= 90 days old) using the "Step-by-Step" approach. This sequential algorithm allows for the identification of low-risk infants who may be managed without lumbar puncture or antibiotics.
Usage
step_by_step_febrile_infant(age_days, ill_appearing, urinalysis_positive,
procalcitonin, crp_mg_l, absolute_neutrophil_count)
Arguments
age_days |
Numeric. Age of the infant in days. |
ill_appearing |
Numeric (0 or 1). Is the infant ill-appearing? (1 = Yes). If Yes, the patient is automatically High Risk. |
urinalysis_positive |
Numeric (0 or 1). Is there leukocyturia (positive urinalysis)? (1 = Yes). If Yes, the patient is High Risk. |
procalcitonin |
Numeric. Serum Procalcitonin level in ng/mL. (>= 0.5 ng/mL indicates High Risk). |
crp_mg_l |
Numeric. C-Reactive Protein level in mg/L. (> 20 mg/L indicates Intermediate Risk if previous steps are negative). |
absolute_neutrophil_count |
Numeric. Absolute Neutrophil Count (ANC) in cells/mm^3. (> 10,000 indicates Intermediate Risk if previous steps are negative). |
Value
A list containing:
Risk_Classification |
The determined risk category (High Risk, Intermediate Risk, or Low Risk). |
Recommendation |
Clinical guidance based on the risk level. |
References
Mintegi S, Bressan S, Gomez B, et al. Accuracy of a sequential approach to identify young febrile infants at low risk for invasive bacterial infection. Emerg Med J. 2014;31(e1):e19-24. doi:10.1136/emermed-2013-202449 Gomez B, Mintegi S, Bressan S, et al. Validation of the "Step-by-Step" Approach in the Management of Young Febrile Infants. Pediatrics. 2016;138(2). doi:10.1542/peds.2015-4381
Examples
# Example 1: Low Risk
# 45 days old, Well-appearing, Neg UA, PCT 0.1, CRP 5, ANC 4000
step_by_step_febrile_infant(45, 0, 0, 0.1, 5, 4000)
# Example 2: High Risk (Procalcitonin)
# 60 days old, Well-appearing, Neg UA, PCT 0.8, CRP 10, ANC 5000
step_by_step_febrile_infant(60, 0, 0, 0.8, 10, 5000)
# Example 3: Intermediate Risk (CRP)
# 50 days old, Well, Neg UA, PCT 0.2, CRP 30, ANC 5000
step_by_step_febrile_infant(50, 0, 0, 0.2, 30, 5000)
Steroid Conversion Calculator
Description
Calculates the equivalent dose of a target corticosteroid based on the dose of a current corticosteroid. The conversion uses standard equianalgesic ratios to estimate the anti-inflammatory potency equivalent. It also provides pharmacological properties (potency, half-life) for the target steroid.
Usage
steroid_conversion_calculator(current_steroid, current_dose_mg, target_steroid)
Arguments
current_steroid |
String. The name of the steroid currently being used. Options: "cortisone", "hydrocortisone", "prednisone", "prednisolone", "triamcinolone", "methylprednisolone", "dexamethasone", "betamethasone". |
current_dose_mg |
Numeric. The dose of the current steroid in milligrams. |
target_steroid |
String. The name of the steroid to convert to. Same options as current_steroid. |
Details
Equivalency Table (mg): Cortisone: 25 Hydrocortisone: 20 Prednisone: 5 Prednisolone: 5 Triamcinolone: 4 Methylprednisolone: 4 Dexamethasone: 0.75 Betamethasone: 0.6
Value
A list containing:
Target_Dose_mg |
The calculated equivalent dose of the target steroid. |
Target_Steroid_Info |
A list of pharmacological properties for the target steroid (Anti-inflammatory potency, Mineralocorticoid potency, Duration). |
Conversion_Ratio |
The ratio used for the specific conversion. |
References
Meikle AW, Tyler FH. Potency and duration of action of glucocorticoids. Am J Med. 1977;63(2):200-207. Webb R, Singer M. Oxford Handbook of Critical Care. Oxford; New York: Oxford University Press; 2005.
Examples
# Example 1: Convert 10mg Prednisone to Hydrocortisone
# 10 * (20 / 5) = 40 mg
steroid_conversion_calculator("prednisone", 10, "hydrocortisone")
# Example 2: Convert 8mg Dexamethasone to Methylprednisolone
# 8 * (4 / 0.75) = 42.67 mg
steroid_conversion_calculator("dexamethasone", 8, "methylprednisolone")
STONE Nephrolithometry Score
Description
Calculates the S.T.O.N.E. Nephrolithometry Score to predict the complexity of Percutaneous Nephrolithotomy (PCNL) and estimated stone-free rates. The score is based on 5 parameters: Stone size, Tract length, Obstruction, Number of involved calyces, and Essence (stone density).
Usage
stone_nephrolithometry_score(stone_size_mm2, tract_length_mm, obstruction_degree,
number_involved_calyces, stone_density_hu)
Arguments
stone_size_mm2 |
Numeric. Stone surface area in mm^2 (typically Length x Width x pi x 0.25). <400: 1 pt. 400-799: 2 pts. 800-1599: 3 pts. >=1600: 4 pts. |
tract_length_mm |
Numeric. Skin-to-stone distance in mm (average of 3 distances on CT). <=100: 1 pt. >100: 2 pts. |
obstruction_degree |
String. Degree of hydronephrosis. "none_mild": 1 pt. "moderate_severe": 2 pts. |
number_involved_calyces |
String. Number of calyces containing stones. "1_or_2": 1 pt. "3": 2 pts. "staghorn": 3 pts. |
stone_density_hu |
Numeric. Stone density in Hounsfield Units. <=950: 1 pt. >950: 2 pts. |
Value
A list containing:
STONE_Score |
The calculated total score (Range 5-13). |
Surgical_Complexity |
Classification (Low, Moderate, High). |
Est_Stone_Free_Rate |
Estimated likelihood of achieving stone-free status. |
References
Okhunov Z, Friedlander JI, George AK, et al. S.T.O.N.E. nephrolithometry: novel surgical classification system for kidney calculi. Urology. 2013;81(6):1154-1159. doi:10.1016/j.urology.2012.10.083
Examples
# Example 1: Low Complexity
# 300mm2, 80mm tract, Mild Hydro, 1 calyx, 800 HU
# Score = 1 + 1 + 1 + 1 + 1 = 5
stone_nephrolithometry_score(300, 80, "none_mild", "1_or_2", 800)
# Example 2: High Complexity
# 1700mm2, 120mm tract, Severe Hydro, Staghorn, 1200 HU
# Score = 4 + 2 + 2 + 3 + 2 = 13
stone_nephrolithometry_score(1700, 120, "moderate_severe", "staghorn", 1200)
STONE Score for Uncomplicated Ureteral Stone
Description
Calculates the STONE Score to predict the likelihood of an uncomplicated ureteral stone in patients presenting with flank pain. This score can help reduce radiation exposure by identifying patients with a high probability of ureteral stones who may not require immediate CT imaging.
Usage
stone_ureteral_score(sex, duration_of_pain_hours, race, nausea_vomiting,
hematuria_on_dipstick)
Arguments
sex |
String. Patient sex ("Male" or "Female"). (Male adds 2 points). |
duration_of_pain_hours |
Numeric. Duration of pain prior to presentation in hours. <6 hours: +3 pts. 6-24 hours: +1 pt. >24 hours: 0 pts. |
race |
String. Patient race ("Black" or "Non_Black"). (Non-Black adds 3 points). |
nausea_vomiting |
Numeric (0, 1, or -1 if specified "none" but usually N/V is present vs absent). Here: Nausea alone = 1 pt, Vomiting = 2 pts, None = 0 pts. (Note: MDCalc implementation often simplifies to Nausea/Vomiting vs None, but original derivation uses graded points: Nausea +1, Vomiting +2). Wait, re-checking standard scoring: Nausea alone: 1 pt. Vomiting: 2 pts. None: 0 pts. Let's assume input 0=None, 1=Nausea, 2=Vomiting. |
hematuria_on_dipstick |
Numeric (0 or 1). Presence of hematuria on urine dipstick. (1 = Yes, +3 points). |
Value
A list containing:
STONE_Score |
The calculated total score (Range 0-13). |
Risk_Category |
Classification (Low, Moderate, High). |
Ureteral_Stone_Probability |
Estimated probability of ureteral stone presence. |
References
Moore CL, Bomann S, Daniels B, et al. Derivation and validation of a clinical prediction rule for uncomplicated ureteral stone—the STONE score: retrospective and prospective validation. BMJ. 2014;348:g2191. doi:10.1136/bmj.g2191
Examples
# Example 1: High Probability
# Male (+2), Pain <6h (+3), Non-Black (+3), Vomiting (+2), Hematuria (+3)
# Score = 13
stone_ureteral_score("male", 4, "non_black", 2, 1)
# Example 2: Low Probability
# Female (0), Pain >24h (0), Black (0), No N/V (0), No Hematuria (0)
# Score = 0
stone_ureteral_score("female", 30, "black", 0, 0)
Stool Osmolar (Osmotic) Gap
Description
Calculates the Stool Osmolar Gap to help differentiate between secretory and osmotic diarrhea. The gap represents the difference between the measured stool osmolality and the estimated stool osmolality contributed by electrolytes (sodium and potassium).
Usage
stool_osmolar_gap(stool_na, stool_k, stool_osmolality = 290)
Arguments
stool_na |
Numeric. Stool Sodium concentration in mmol/L (or mEq/L). |
stool_k |
Numeric. Stool Potassium concentration in mmol/L (or mEq/L). |
stool_osmolality |
Numeric. Measured stool osmolality in mOsm/kg. If not measured, 290 mOsm/kg (plasma osmolality) is often used as a surrogate value. Defaults to 290. |
Details
The formula used is:
Gap = Stool Osmolality_{measured} - 2 \times (Stool Na + Stool K)
Interpretation:
-
< 50 mOsm/kg: Suggests Secretory Diarrhea (e.g., toxins, hormones).
-
> 100 mOsm/kg: Suggests Osmotic Diarrhea (e.g., malabsorption, laxatives).
-
50 - 100 mOsm/kg: Indeterminate.
Value
A list containing:
Stool_Osmotic_Gap |
The calculated gap value. |
Interpretation |
Diagnostic classification based on the gap. |
References
Eherer AJ, Fordtran JS. Fecal osmotic gap and pH in experimental diarrhea of various causes. Gastroenterology. 1992;103(2):545-551. doi:10.1016/0016-5085(92)90845-s
Examples
# Example 1: Osmotic Diarrhea (e.g., Lactose Intolerance)
# Na 30, K 30, Meas Osm 290 -> Gap = 290 - 2(60) = 170
stool_osmolar_gap(30, 30, 290)
# Example 2: Secretory Diarrhea (e.g., Cholera)
# Na 90, K 40, Meas Osm 280 -> Gap = 280 - 2(130) = 20
stool_osmolar_gap(90, 40, 280)
STOP-Bang Score for Obstructive Sleep Apnea
Description
Calculates the STOP-Bang score to screen for Obstructive Sleep Apnea (OSA). The score is based on Snoring, Tiredness, Observed apnea, Blood Pressure, BMI, Age, Neck circumference, and Gender. A score of 3 or more indicates a high risk of OSA.
Usage
stop_bang_score(snoring, tired, observed_apnea, pressure, bmi, age,
neck_circumference, gender)
Arguments
snoring |
Numeric (0 or 1). Do you snore loudly? (1 = Yes). |
tired |
Numeric (0 or 1). Do you often feel tired, fatigued, or sleepy during daytime? (1 = Yes). |
observed_apnea |
Numeric (0 or 1). Has anyone observed you stop breathing during your sleep? (1 = Yes). |
pressure |
Numeric (0 or 1). Do you have or are you being treated for high blood pressure? (1 = Yes). |
bmi |
Numeric. Body Mass Index (kg/m^2). (> 35 kg/m^2 adds 1 point). |
age |
Numeric. Age in years. (> 50 years adds 1 point). |
neck_circumference |
Numeric. Neck circumference in cm. (> 40 cm adds 1 point). |
gender |
String. Gender ("Male" or "Female"). (Male adds 1 point). |
Value
A list containing:
STOP_Bang_Score |
The calculated total score (Range 0-8). |
Risk_Category |
Classification (Low 0-2, Intermediate 3-4, High 5-8). |
References
Chung F, Yegneswaran B, Liao P, et al. STOP-Bang questionnaire: a practical approach to screen for obstructive sleep apnea. Chest. 2008;133(3):592-598. doi:10.1378/chest.07-2587
Examples
# Example 1: High Risk
# Snoring, Tired, Observed, BP, BMI 36, Age 55, Neck 42, Male
# Score = 1+1+1+1+1+1+1+1 = 8
stop_bang_score(1, 1, 1, 1, 36, 55, 42, "male")
# Example 2: Low Risk
# No symptoms, BMI 22, Age 30, Neck 35, Female
# Score = 0
stop_bang_score(0, 0, 0, 0, 22, 30, 35, "female")
STUMBL (Battle) Score for Blunt Chest Wall Trauma
Description
Calculates the STUMBL (STUdy of the Management of BLunt chest wall trauma) Score, also known as the Battle Score. This clinical decision rule predicts the risk of complications (e.g., pneumonia, pleural effusion, respiratory failure) in patients with blunt chest wall trauma to guide disposition (discharge vs. admission).
Usage
stumbl_battle_score(age, num_rib_fractures, chronic_lung_disease,
anticoagulant_use, spo2_percent)
Arguments
age |
Numeric. Patient age in years. (>= 65 years adds 5 points). |
num_rib_fractures |
Numeric. Number of rib fractures identified on imaging. (>= 3 adds 4 points). |
chronic_lung_disease |
Numeric (0 or 1). History of chronic lung disease (e.g., COPD, asthma). (1 = Yes, +5 points). |
anticoagulant_use |
Numeric (0 or 1). Pre-injury use of anticoagulants or antiplatelet medication. (1 = Yes, +4 points). |
spo2_percent |
Numeric. Oxygen saturation percentage on room air. (< 90% adds 6 points). |
Value
A list containing:
STUMBL_Score |
The calculated total score (Range 0-24). |
Risk_Category |
Risk stratification (Low <= 10, High >= 11). |
Management_Guidance |
Recommendations for discharge or admission based on the score. |
References
Battle C, Hutchings H, Lovett S, et al. Predicting outcomes after blunt chest wall trauma: development and external validation of a new prognostic model. Crit Care. 2014;18(3):R98. doi:10.1186/cc13873
Examples
# Example 1: High Risk
# 70yo (+5), 3 ribs (+4), COPD (+5), SpO2 95%
# Score = 14
stumbl_battle_score(70, 3, 1, 0, 95)
# Example 2: Low Risk
# 40yo, 2 ribs, No hx, SpO2 98%
# Score = 0
stumbl_battle_score(40, 2, 0, 0, 98)
Subtle Anterior STEMI Calculator (4-Variable)
Description
Calculates the 4-Variable score to differentiate between subtle anterior STEMI (LAD occlusion) and Early Repolarization in patients with chest pain and subtle ST-segment elevation. A score greater than or equal to 18.2 predicts STEMI with high sensitivity and specificity.
Usage
subtle_anterior_stemi_4_variable(qtc_ms, qrs_v2_mm, r_wave_v4_mm, ste_60_v3_mm)
Arguments
qtc_ms |
Numeric. The computerized QTc interval in milliseconds. |
qrs_v2_mm |
Numeric. The total QRS amplitude in lead V2 in millimeters. |
r_wave_v4_mm |
Numeric. The R-wave amplitude in lead V4 in millimeters. |
ste_60_v3_mm |
Numeric. ST-segment elevation at 60 milliseconds after the J-point in lead V3, measured in millimeters. |
Value
A list containing:
Score |
The calculated 4-variable model score. |
Interpretation |
Prediction of "Likely Anterior STEMI" or "Likely Early Repolarization" based on the 18.2 cutoff. |
References
Smith SW, Khalil A, Henry TD, et al. Electrocardiographic differentiation of early repolarization from subtle anterior ST-segment elevation myocardial infarction. Ann Emerg Med. 2012;60(1):45-56.e2. doi:10.1016/j.annemergmed.2012.02.015
Examples
# Example 1: Likely Early Repolarization
# QTc 390ms, QRS V2 25mm, R-wave V4 15mm, STE60 V3 1.5mm
# Score = (0.052*390) - (0.151*25) - (0.268*15) + (1.062*1.5) = 14.08
subtle_anterior_stemi_4_variable(390, 25, 15, 1.5)
# Example 2: Likely Anterior STEMI
# QTc 420ms, QRS V2 10mm, R-wave V4 5mm, STE60 V3 3.0mm
# Score = (0.052*420) - (0.151*10) - (0.268*5) + (1.062*3.0) = 22.18
subtle_anterior_stemi_4_variable(420, 10, 5, 3.0)
Sudbury Vertigo Risk Score
Description
Calculates the Sudbury Vertigo Risk Score to stratify the risk of cerebrovascular events (stroke/TIA) in patients presenting with vertigo or dizziness. The score is based on demographic and vascular risk factors.
Usage
sudbury_vertigo_risk_score(age_years, sex, hypertension, diabetes,
dyslipidemia, coronary_artery_disease,
history_stroke_tia, smoker)
Arguments
age_years |
Numeric. Patient age in years. (Age >= 65 adds 1 point). |
sex |
String. Patient sex ("Male" or "Female"). (Male adds 1 point). |
hypertension |
Numeric (0 or 1). History of hypertension. (1 = Yes, +1 point). |
diabetes |
Numeric (0 or 1). History of diabetes mellitus. (1 = Yes, +1 point). |
dyslipidemia |
Numeric (0 or 1). History of dyslipidemia/high cholesterol. (1 = Yes, +1 point). |
coronary_artery_disease |
Numeric (0 or 1). History of coronary artery disease (MI, angina, CABG/PCI). (1 = Yes, +1 point). |
history_stroke_tia |
Numeric (0 or 1). History of prior stroke or Transient Ischemic Attack (TIA). (1 = Yes, +1 point). |
smoker |
Numeric (0 or 1). Current smoker. (1 = Yes, +1 point). |
Value
A list containing:
Sudbury_Score |
The calculated total risk score (Range 0-8). |
Risk_Category |
Classification of stroke risk (Low, Moderate, High). |
References
Tran D, et al. Derivation of a clinical decision rule for the prediction of stroke in patients with vertigo: the Sudbury Vertigo Risk Score. (Ongoing validation studies).
Examples
# Example 1: High Risk
# 70yo Male (+2), HTN (+1), DM (+1), CAD (+1)
# Score = 5
sudbury_vertigo_risk_score(70, "male", 1, 1, 0, 1, 0, 0)
# Example 2: Low Risk
# 40yo Female, No risk factors
# Score = 0
sudbury_vertigo_risk_score(40, "female", 0, 0, 0, 0, 0, 0)
SULF-FAST Penicillin Allergy Decision Rule
Description
Calculates the SULF-FAST score to stratify the risk of a true Trimethoprim-Sulfamethoxazole (TMP-SMX) allergy. The score helps identify patients who may be candidates for direct oral challenge versus those requiring further evaluation.
Usage
sulf_fast_score(reaction_lt_5_years, anaphylaxis_or_angioedema,
severe_cutaneous_adverse_reaction, organ_involvement)
Arguments
reaction_lt_5_years |
Numeric (0 or 1). Did the reaction occur less than 5 years ago? (1 = Yes, +2 points). |
anaphylaxis_or_angioedema |
Numeric (0 or 1). Did the reaction involve anaphylaxis or angioedema? (1 = Yes, +2 points). |
severe_cutaneous_adverse_reaction |
Numeric (0 or 1). Is there a history of Severe Cutaneous Adverse Reaction (SCAR) such as SJS, TEN, or DRESS? (1 = Yes, +1 point). |
organ_involvement |
Numeric (0 or 1). Did the reaction involve internal organs (e.g., hepatitis, nephritis, pneumonitis, cytopenias)? (1 = Yes, +2 points). |
Value
A list containing:
SULF_FAST_Score |
The calculated total score (Range 0-7). |
Risk_Category |
Risk stratification (Low Risk <= 2, High Risk >= 3). |
Recommendation |
Clinical guidance regarding oral challenge. |
References
Trubiano JA, et al. The SULF-FAST antibiotic allergy clinical decision rule. J Allergy Clin Immunol Pract. 2023.
Examples
# Example 1: Low Risk
# Reaction > 5 years ago (0), No anaphylaxis (0), No SCAR (0), No organ involvement (0)
# Score = 0
sulf_fast_score(0, 0, 0, 0)
# Example 2: High Risk
# Reaction < 5 years (2), Anaphylaxis (2)
# Score = 4
sulf_fast_score(1, 1, 0, 0)
Surgical Apgar Score (SAS)
Description
Calculates the Surgical Apgar Score, a 10-point scoring system used to predict 30-day major complications or death after general or vascular surgery. It utilizes three intraoperative variables: estimated blood loss, lowest mean arterial pressure, and lowest heart rate.
Usage
surgical_apgar_score(blood_loss_ml, lowest_map_mmhg, lowest_heart_rate)
Arguments
blood_loss_ml |
Numeric. Estimated blood loss in milliliters (mL). |
lowest_map_mmhg |
Numeric. The lowest mean arterial pressure recorded during the procedure (mmHg). |
lowest_heart_rate |
Numeric. The lowest heart rate recorded during the procedure (beats per minute). Note: While counter-intuitive, lower intraoperative heart rates are associated with better outcomes in this specific risk model, likely due to beta-blockade or lack of stress response. |
Details
The score ranges from 0 to 10, where a lower score indicates a higher risk of complications. Scoring logic: Blood Loss: <=100 (3), 101-600 (2), 601-1000 (1), >1000 (0). Lowest MAP: >=75 (3), 55-74 (2), 40-54 (1), <40 (0). Lowest HR: <=55 (3), 56-65 (2), 66-75 (1), >75 (0).
Value
A list containing:
SAS_Score |
The calculated total score. |
Risk_Category |
Risk classification (High, Medium, Low, Very Low). |
Risk_Estimate |
Estimated 30-day complication or mortality rate. |
References
Gawande AA, Kwaan MR, Regenbogen SE, Lipsitz SA, Zinner MJ. An Apgar score for surgery. J Am Coll Surg. 2007;204(2):201-208. doi:10.1016/j.jamcollsurg.2006.11.011
Examples
# Example 1: High Risk Patient
# High blood loss, low MAP, high HR
surgical_apgar_score(1200, 35, 90)
# Example 2: Low Risk Patient
# Minimal blood loss, stable MAP, low HR
surgical_apgar_score(50, 80, 50)
Swede Score for Colposcopy
Description
Calculates the Swede Score to grade the severity of cervical lesions during colposcopy. The score sums five colposcopic variables (Acetowhitening, Margins, Vessel patterns, Lesion size, and Iodine staining), each scored from 0 to 2. Higher scores correlate with higher-grade cervical intraepithelial neoplasia (CIN).
Usage
swede_colposcopic_score(acetowhitening, margins, vessels, lesion_size,
iodine_staining)
Arguments
acetowhitening |
Numeric (0-2). Reaction to acetic acid. 0: Zero or transparent. 1: Faint or translucent. 2: Distinct, opaque white. |
margins |
Numeric (0-2). Margin/Surface characteristics. 0: Diffuse or irregular edges. 1: Sharp but irregular edges. 2: Sharp/rolled edges or internal borders ("cuffing"). |
vessels |
Numeric (0-2). Vessel patterns. 0: Fine, regular. 1: Absent. 2: Coarse or atypical. |
lesion_size |
Numeric (0-2). Size of the lesion. 0: < 5 mm. 1: 5 - 15 mm or 2 quadrants. 2: > 15 mm or 3-4 quadrants or endocervical undefined. |
iodine_staining |
Numeric (0-2). Reaction to Lugol's iodine. 0: Brown (Positive uptake). 1: Faintly yellow or speckled. 2: Distinct mustard yellow (Negative uptake). |
Value
A list containing:
Swede_Score |
The calculated total score (Range 0-10). |
Interpretation |
Diagnostic likelihood (Normal/CIN1, CIN2/3, CIN3/Cancer). |
References
Strander B, Ellström-Andersson A, Franzén S, Milsom I, Rådberg T. The performance of a new scoring system for colposcopy in detecting high-grade dysplasia in the uterine cervix. Acta Obstet Gynecol Scand. 2005;84(10):1013-1017. doi:10.1111/j.0001-6349.2005.00895.x
Examples
# Example 1: Low Grade
# Faint white (1), Diffuse margin (0), Fine vessels (0), Small (0), Partial iodine (1)
# Score = 2
swede_colposcopic_score(1, 0, 0, 0, 1)
# Example 2: High Grade
# Dense white (2), Sharp margins (1), Coarse vessels (2), Large (2), Yellow iodine (2)
# Score = 9
swede_colposcopic_score(2, 1, 2, 2, 2)
Troponin-only Manchester Acute Coronary Syndromes (T-MACS) Decision Aid
Description
Calculates the probability of Acute Coronary Syndrome (ACS) using the T-MACS decision aid. This tool incorporates high-sensitivity cardiac troponin T (hs-cTnT), Heart-type Fatty Acid Binding Protein (H-FABP), ECG findings, and clinical symptoms to risk-stratify patients presenting with chest pain. Note: While the original MACS rule included H-FABP, the T-MACS variation typically relies on hs-cTnT alone or in combination; this function implements the full multivariable model as described in the primary derivation study which included H-FABP.
Usage
t_macs_decision_aid(hs_ctn_t_ng_l, heart_type_fatty_acid_binding_protein_ng_ml,
ecg_ischemia, sweating, pain_radiates_to_right_arm_shoulder,
pain_worsens_with_movement_palpation, vomiting)
Arguments
hs_ctn_t_ng_l |
Numeric. High-sensitivity cardiac troponin T level in ng/L. |
heart_type_fatty_acid_binding_protein_ng_ml |
Numeric. Heart-type Fatty Acid Binding Protein (H-FABP) level in ng/mL. |
ecg_ischemia |
Numeric (0 or 1). Evidence of ischemia on ECG (ST depression, T-wave inversion). (1 = Yes). |
sweating |
Numeric (0 or 1). Observed sweating. (1 = Yes). |
pain_radiates_to_right_arm_shoulder |
Numeric (0 or 1). Pain radiates to the right arm or shoulder. (1 = Yes). |
pain_worsens_with_movement_palpation |
Numeric (0 or 1). Pain worsens with movement or palpation. (1 = Yes). |
vomiting |
Numeric (0 or 1). Associated vomiting. (1 = Yes). |
Value
A list containing:
Probability_ACS |
The calculated probability of ACS. |
Risk_Category |
Risk stratification (Very Low, Low, Moderate, High). |
References
Body R, et al. The Manchester Acute Coronary Syndromes (MACS) decision rule for suspected cardiac chest pain: derivation and external validation. Heart. 2014;100(18):1462-1468. doi:10.1136/heartjnl-2014-305564 Body R, et al. A rapid rule-out for acute coronary syndromes using a single high-sensitivity cardiac troponin T measurement: the T-MACS decision aid.
Examples
# Example 1: High Risk
# hs-cTnT 50, H-FABP 6, ECG Ischemia, Sweating
# Log-odds calculation leads to high probability
t_macs_decision_aid(50, 6, 1, 1, 0, 0, 0)
# Example 2: Very Low Risk
# hs-cTnT 3, H-FABP 1.5, No symptoms
t_macs_decision_aid(3, 1.5, 0, 0, 0, 0, 0)
Trauma Associated Severe Hemorrhage (TASH) Score
Description
Calculates the TASH Score to predict the probability of needing a massive transfusion (>= 10 units of packed red blood cells) in trauma patients. The score uses seven independent variables available early in the trauma room.
Usage
tash_score_trauma(systolic_bp, hemoglobin, fast_positive, complex_fractures,
heart_rate, base_excess, sex)
Arguments
systolic_bp |
Numeric. Systolic blood pressure in mmHg. <100: +4 pts. 100-120: +1 pt. >120: 0 pts. |
hemoglobin |
Numeric. Hemoglobin level in g/dL. <7: +6 pts. 7-<9: +4 pts. 9-<11: +3 pts. 11-<12: +2 pts. >=12: 0 pts. |
fast_positive |
Numeric (0 or 1). Positive Focused Assessment with Sonography for Trauma (FAST) for intra-abdominal fluid. (1 = Yes, +3 pts). |
complex_fractures |
Numeric (0 or 1). Presence of clinically unstable pelvic fracture or open/dislocated femur fracture. (1 = Yes, +3 pts). |
heart_rate |
Numeric. Heart rate in bpm. (>120: +2 pts). |
base_excess |
Numeric. Base excess in mmol/L. <-10: +4 pts. -10 to <-6: +3 pts. -6 to <-2: +1 pt. >=-2: 0 pts. |
sex |
String. Patient sex ("Male" or "Female"). (Male: +1 pt). |
Value
A list containing:
TASH_Score |
The calculated total score (Range 0-28). |
Probability_Massive_Transfusion |
The estimated probability of requiring massive transfusion based on the score. |
References
Yücel N, Lefering R, Maegele M, et al. Trauma Associated Severe Hemorrhage (TASH)-Score: probability of mass transfusion as surrogate for life threatening hemorrhage after multiple trauma. J Trauma. 2006;60(6):1228-1236. doi:10.1097/01.ta.0000220386.84012.bf
Examples
# Example 1: High Risk
# SBP 90 (4), Hb 8 (4), FAST+ (3), Pelvic Fx (3), HR 130 (2), BE -8 (3), Male (1)
# Score = 20
tash_score_trauma(90, 8, 1, 1, 130, -8, "male")
# Example 2: Low Risk
# SBP 130 (0), Hb 13 (0), FAST- (0), No Fx (0), HR 90 (0), BE 0 (0), Female (0)
# Score = 0
tash_score_trauma(130, 13, 0, 0, 90, 0, "female")
Therapy-Disability-Neurology (TDN) Grade
Description
Calculates the TDN Grade for grading the severity of adverse events (AEs) in neurosurgery. Unlike therapy-based classifications (e.g., Clavien-Dindo), the TDN grade incorporates three dimensions: the Therapy used to treat the AE, the resulting Disability (based on the modified Rankin Scale), and the presence of new Neurologic deficits. The final grade is determined by the highest severity across these three domains.
Usage
tdn_neurology_grade(therapy_level, disability_mrs, new_neurologic_deficit)
Arguments
therapy_level |
String. The therapy required to manage the adverse event. "none_bedside": Allowed modalities only (antiemetics, antipyretics, analgesics, diuretics, electrolytes, bedside wound opening). (T1). "pharmacologic": Pharmacological treatment (e.g., antibiotics), blood transfusion, or TPN. (T2). "invasive": Surgical, endoscopic, or radiological intervention. (T3). "icu_life_threatening": Life-threatening complication requiring ICU management. (T4). "death": Resulting in death. (T5). |
disability_mrs |
Numeric. The patient's modified Rankin Scale (mRS) score describing functional status/disability associated with the AE. 0-1: No significant disability (D1). 2-3: Slight to moderate disability (hinders at least one ADL) (D2). 4: Moderately severe disability (unable to walk/attend bodily needs without assistance) (D3). 5: Severe disability (bedridden, incontinent, constant nursing care) (D4). 6: Death (D5). |
new_neurologic_deficit |
Numeric (0 or 1). Did the adverse event result in a new neurological deficit? (1 = Yes [N2], 0 = No [N1]). |
Value
A list containing:
TDN_Grade |
The calculated severity grade (1-5). |
Definition |
Clinical description of the grade. |
Inputs |
The individual scores (T, D, N) contributing to the final grade. |
References
Terrapon APR, Zattra CM, Voglis S, et al. Adverse Events in Neurosurgery: The Novel Therapy-Disability-Neurology Grade. Neurosurgery. 2021;89(2):236-245. doi:10.1093/neuros/nyab121
Examples
# Example 1: Grade 2 (New deficit, but no major therapy or severe disability)
# Therapy: Bedside (T1), mRS 1 (D1), New Neuro Deficit (N2) -> Max(1,1,2) = 2
tdn_neurology_grade("none_bedside", 1, 1)
# Example 2: Grade 3 (Invasive therapy required)
# Therapy: Surgical repair (T3), mRS 2 (D2), New Neuro Deficit (N2) -> Max(3,2,2) = 3
tdn_neurology_grade("invasive", 2, 1)
# Example 3: Grade 4 (Severe disability)
# Therapy: Pharmacologic (T2), mRS 5 (D4), New Neuro Deficit (N2) -> Max(2,4,2) = 4
tdn_neurology_grade("pharmacologic", 5, 1)
Tenecteplase (TNKase) Dosing Calculator
Description
Calculates the recommended dose of Tenecteplase for the treatment of Acute Myocardial Infarction (STEMI) or Acute Ischemic Stroke. Dosing for STEMI is based on weight tiers, while dosing for stroke is calculated as 0.25 mg/kg with a maximum limit.
Usage
tenecteplase_dosing(weight_kg, indication = "stemi")
Arguments
weight_kg |
Numeric. Patient weight in kilograms. |
indication |
String. Clinical indication for treatment. Options: "stemi" (default) or "stroke". STEMI Dosing: <60 kg: 30 mg 60-69 kg: 35 mg 70-79 kg: 40 mg 80-89 kg: 45 mg >=90 kg: 50 mg Stroke Dosing: 0.25 mg/kg (Max 25 mg). |
Value
A list containing:
Recommended_Dose_mg |
The calculated dose in milligrams. |
Volume_to_Administer_mL |
The volume to administer in milliliters (based on standard 5 mg/mL reconstitution). |
References
TNKase (Tenecteplase) [Package Insert]. South San Francisco, CA: Genentech, Inc. Haley EC Jr, et al. Tenecteplase in acute ischemic stroke: results of a randomized controlled trial. Stroke. 2010;41(4):707-711.
Examples
# Example 1: STEMI, 75 kg
# Tier 70-79kg -> 40 mg
tenecteplase_dosing(75, "stemi")
# Example 2: Stroke, 110 kg
# 0.25 * 110 = 27.5 mg -> Capped at 25 mg
tenecteplase_dosing(110, "stroke")
Acute Renal Failure after Cardiac Surgery (Thakar Score)
Description
Calculates the Thakar Score to predict the risk of Acute Renal Failure (ARF) requiring dialysis after open heart surgery. This scoring system uses preoperative variables to stratify patients into risk groups (Low, Moderate, High, Very High).
Usage
thakar_arf_cardiac_surgery(gender, chf, lvef_lt_35, preop_iabp, copd,
insulin_dependent_dm, prev_cardiac_surgery,
emergency_surgery, surgery_type, creatinine_mg_dl)
Arguments
gender |
String. Patient gender ("Male" or "Female"). (Female +1 point). |
chf |
Numeric (0 or 1). Congestive Heart Failure. (1 = Yes, +1 point). |
lvef_lt_35 |
Numeric (0 or 1). Left Ventricular Ejection Fraction < 35%. (1 = Yes, +1 point). |
preop_iabp |
Numeric (0 or 1). Preoperative Intra-Aortic Balloon Pump use. (1 = Yes, +2 points). |
copd |
Numeric (0 or 1). Chronic Obstructive Pulmonary Disease. (1 = Yes, +1 point). |
insulin_dependent_dm |
Numeric (0 or 1). Insulin-requiring Diabetes Mellitus. (1 = Yes, +1 point). |
prev_cardiac_surgery |
Numeric (0 or 1). History of previous cardiac surgery. (1 = Yes, +1 point). |
emergency_surgery |
Numeric (0 or 1). Surgery is emergent (required before next working day). (1 = Yes, +2 points). |
surgery_type |
String. Type of surgery. "cabg": CABG only (0 points). "valve": Valve only (+1 point). "cabg+valve": CABG + Valve (+2 points). "other": Other cardiac surgery (+2 points). |
creatinine_mg_dl |
Numeric. Preoperative serum creatinine in mg/dL. < 1.2: 0 points. 1.2 - 2.0: +2 points. >= 2.1: +5 points. |
Value
A list containing:
Thakar_Score |
The calculated score (Range 0-17). |
Risk_Group |
Risk classification group. |
Est_Risk_Dialysis_Requirement |
Predicted probability of requiring dialysis. |
References
Thakar CV, Arrigain S, Worley S, Yared JP, Paganini EP. A clinical score to predict acute renal failure after cardiac surgery. J Am Soc Nephrol. 2005;16(1):162-168. doi:10.1681/ASN.2004040331
Examples
# Example 1: High Risk
# Female, Diabetic (Insulin), Cr 1.5, CABG+Valve
# Score = 1 (F) + 1 (DM) + 2 (Cr) + 2 (Surg) = 6 -> High Risk (7.0%)
thakar_arf_cardiac_surgery("female", 0, 0, 0, 0, 1, 0, 0, "cabg+valve", 1.5)
# Example 2: Low Risk
# Male, No comorbidities, Cr 0.9, CABG only
# Score = 0 -> Low Risk (0.4%)
thakar_arf_cardiac_surgery("male", 0, 0, 0, 0, 0, 0, 0, "cabg", 0.9)
Therapeutic Plasmapheresis (Plasma Exchange) Calculator
Description
Calculates the estimated Total Blood Volume (TBV), Estimated Plasma Volume (EPV), and the total volume of plasma to be removed/exchanged based on patient weight, hematocrit, and the desired number of plasma volumes to exchange.
Usage
therapeutic_plasmapheresis(weight_kg, hematocrit_percent, exchange_volume_pv = 1.0)
Arguments
weight_kg |
Numeric. Patient weight in kilograms. |
hematocrit_percent |
Numeric. Patient's hematocrit as a percentage (0-100). |
exchange_volume_pv |
Numeric. The target number of plasma volumes to exchange (e.g., 1.0, 1.2, 1.5). Defaults to 1.0. |
Details
The calculations use the following standard estimations (Gilcher's rule of thumb):
TBV (mL) = Weight (kg) \times 70 mL/kg
EPV (mL) = TBV \times (1 - Hct)
Exchange Volume (mL) = EPV \times Target PV
Note: 70 mL/kg is a standard estimate for adults; actual blood volume may vary based on body composition and demographics.
Value
A list containing:
Total_Blood_Volume_mL |
Estimated Total Blood Volume. |
Estimated_Plasma_Volume_mL |
Estimated total plasma volume of the patient. |
Volume_to_Exchange_mL |
The volume of plasma to be removed/exchanged to meet the target. |
References
Kaplan AA. Therapeutic plasma exchange: A technical overview. J Clin Apher. 2013;28(1):3-10.
Examples
# Example 1: Standard 1.0 PV exchange
# 70kg patient, Hct 40%
# TBV = 4900, EPV = 4900 * 0.6 = 2940 mL
therapeutic_plasmapheresis(70, 40, 1.0)
# Example 2: 1.5 PV exchange for TTP
# 80kg patient, Hct 30%
# TBV = 5600, EPV = 5600 * 0.7 = 3920 mL
# Exchange = 3920 * 1.5 = 5880 mL
therapeutic_plasmapheresis(80, 30, 1.5)
THRIVE Score for Stroke Outcome
Description
Calculates the Totaled Health Risks in Vascular Events (THRIVE) score to predict clinical outcomes (functional independence and mortality) at 90 days in patients with acute ischemic stroke. The score integrates stroke severity (NIHSS), age, and chronic medical conditions (hypertension, diabetes, atrial fibrillation).
Usage
thrive_stroke_score(nihss_score, age, history_hypertension, history_diabetes,
history_atrial_fibrillation)
Arguments
nihss_score |
Numeric. National Institutes of Health Stroke Scale score (0-42). 0-5: 0 pts. 6-10: 2 pts. 11-20: 4 pts. >20: 7 pts. |
age |
Numeric. Patient age in years. 18-59: 0 pts. 60-79: 1 pt. >=80: 2 pts. |
history_hypertension |
Numeric (0 or 1). History of hypertension. (1 = Yes). |
history_diabetes |
Numeric (0 or 1). History of diabetes mellitus. (1 = Yes). |
history_atrial_fibrillation |
Numeric (0 or 1). History of atrial fibrillation. (1 = Yes). Note: Presence of ANY chronic disease (HTN, DM, or AF) adds 1 point total. |
Value
A list containing:
THRIVE_Score |
The calculated total score (Range 0-10). |
Good_Outcome_Probability_90d |
Estimated probability of a good neurological outcome (mRS 0-2). |
Mortality_Risk_90d |
Estimated risk of death within 90 days. |
References
Flint AC, Cullen SP, Faigeles BS, Rao VA. Predicting long-term outcome after endovascular stroke treatment: the THRIVE score. Stroke. 2010;41(8):1792-1796. doi:10.1161/STROKEAHA.110.588277
Examples
# Example 1: Good Outcome Likely
# NIHSS 4 (0), Age 55 (0), No comorbidities (0)
# Score = 0
thrive_stroke_score(4, 55, 0, 0, 0)
# Example 2: Poor Outcome Likely
# NIHSS 22 (7), Age 82 (2), HTN and AFib (1)
# Score = 10
thrive_stroke_score(22, 82, 1, 0, 1)
TIMI Risk Index (TRI) for STEMI
Description
Calculates the TIMI Risk Index for patients with ST-Elevation Myocardial Infarction (STEMI). The index is a continuous variable derived from heart rate, systolic blood pressure, and age, which predicts 30-day mortality. It stratifies patients into five risk groups based on data from the InTIME II trial.
Usage
timi_risk_index(heart_rate, systolic_bp, age)
Arguments
heart_rate |
Numeric. Heart rate in beats per minute (bpm). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
age |
Numeric. Patient age in years. |
Details
The formula used is:
TRI = \frac{Heart Rate \times (Age/10)^2}{Systolic BP}
Risk Groups (30-day mortality):
Group I (< 12.5): 0.8%
Group II (12.5 - <17.5): 1.9%
Group III (17.5 - <22.5): 3.3%
Group IV (22.5 - 30): 7.3%
Group V (> 30): 17.4%
Value
A list containing:
TIMI_Risk_Index |
The calculated index score. |
Risk_Group |
The risk quintile (Group I-V). |
Est_30_Day_Mortality |
Estimated 30-day mortality percentage. |
References
Morrow DA, Antman Giugliano RP, et al. A simple bedside risk score for early risk stratification in patients with acute coronary syndromes. Circulation. 2000;102(suppl II):II-203. Morrow DA, Antman EM, Charlesworth A, et al. TIMI risk score for ST-elevation myocardial infarction: A convenient, bedside, clinical score for risk assessment at presentation: An intravenous nPA for treatment of infarcting myocardium early II trial substudy. Circulation. 2000;102(17):2031-2037. doi:10.1161/01.cir.102.17.2031
Examples
# Example 1: High Risk
# HR 100, SBP 100, Age 75
# TRI = (100 * (7.5^2)) / 100 = 56.25
timi_risk_index(100, 100, 75)
# Example 2: Low Risk
# HR 60, SBP 140, Age 50
# TRI = (60 * (5.0^2)) / 140 = (60 * 25) / 140 = 10.7
timi_risk_index(60, 140, 50)
TIMI Risk Score for STEMI
Description
Calculates the TIMI Risk Score for ST-Elevation Myocardial Infarction (STEMI). This score estimates 30-day mortality in patients presenting with STEMI based on clinical characteristics available at admission.
Usage
timi_stemi_score(age, history_diabetes_htn_angina, systolic_bp, heart_rate,
killip_class_2_to_4, weight_kg, anterior_ste_or_lbbb,
time_to_treatment_gt_4h)
Arguments
age |
Numeric. Patient age in years. Scoring: <65 (0), 65-74 (2), >=75 (3). |
history_diabetes_htn_angina |
Numeric (0 or 1). History of Diabetes, Hypertension, or Angina. (1 = Yes, +1 point). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. (<100 mmHg adds 3 points). |
heart_rate |
Numeric. Heart rate in beats per minute. (>100 bpm adds 2 points). |
killip_class_2_to_4 |
Numeric (0 or 1). Killip Class II-IV (evidence of heart failure like jugular venous distention, rales, or pulmonary edema). (1 = Yes, +2 points). |
weight_kg |
Numeric. Patient weight in kilograms. (<67 kg adds 1 point). |
anterior_ste_or_lbbb |
Numeric (0 or 1). Anterior ST-segment elevation or Left Bundle Branch Block (LBBB) on ECG. (1 = Yes, +1 point). |
time_to_treatment_gt_4h |
Numeric (0 or 1). Time to treatment > 4 hours. (1 = Yes, +1 point). |
Value
A list containing:
TIMI_Score |
The calculated risk score (Range 0-14). |
Est_30_Day_Mortality |
Estimated 30-day mortality percentage based on the score. |
References
Morrow DA, Antman EM, Charlesworth A, et al. TIMI risk score for ST-elevation myocardial infarction: A convenient, bedside, clinical score for risk assessment at presentation: An intravenous nPA for treatment of infarcting myocardium early II trial substudy. Circulation. 2000;102(17):2031-2037. doi:10.1161/01.cir.102.17.2031
Examples
# Example 1: High Risk
# 76yo (+3), Hx HTN (+1), SBP 90 (+3), HR 110 (+2), Killip III (+2), 80kg, Ant STE (+1), Time <4h
# Score = 3 + 1 + 3 + 2 + 2 + 0 + 1 + 0 = 12
timi_stemi_score(76, 1, 90, 110, 1, 80, 1, 0)
# Example 2: Low Risk
# 55yo (0), No Hx, SBP 130, HR 80, Killip I, 80kg, Inferior STE (0), Time <4h
# Score = 0
timi_stemi_score(55, 0, 130, 80, 0, 80, 0, 0)
TIMI Risk Score for UA/NSTEMI
Description
Calculates the TIMI Risk Score for Unstable Angina (UA) and Non-ST Elevation Myocardial Infarction (NSTEMI). This score estimates the 14-day risk of all-cause mortality, new or recurrent MI, or severe recurrent ischemia requiring urgent revascularization based on seven clinical risk factors.
Usage
timi_ua_nstemi_score(age, risk_factors_cad_ge_3, known_cad_stenosis,
aspirin_use_7d, severe_angina_24h, st_deviation,
positive_cardiac_marker)
Arguments
age |
Numeric. Patient age in years. (>= 65 adds 1 point). |
risk_factors_cad_ge_3 |
Numeric (0 or 1). Presence of 3 or more risk factors for CAD (Family history, Hypertension, Hypercholesterolemia, Diabetes, Active Smoker). (1 = Yes, +1 point). |
known_cad_stenosis |
Numeric (0 or 1). Known CAD (stenosis >= 50%). (1 = Yes, +1 point). |
aspirin_use_7d |
Numeric (0 or 1). Aspirin use in the past 7 days. (1 = Yes, +1 point). |
severe_angina_24h |
Numeric (0 or 1). Severe angina (>= 2 episodes in 24 hours). (1 = Yes, +1 point). |
st_deviation |
Numeric (0 or 1). ST-segment deviation >= 0.5 mm. (1 = Yes, +1 point). |
positive_cardiac_marker |
Numeric (0 or 1). Elevated serum cardiac markers (CK-MB or Troponin). (1 = Yes, +1 point). |
Value
A list containing:
TIMI_Score |
The calculated total score (Range 0-7). |
Risk_Composite_14_Day |
Estimated percentage risk of the composite outcome (death, new/recurrent MI, or urgent revascularization) at 14 days. |
References
Antman EM, Cohen M, Bernink PJ, et al. The TIMI risk score for unstable angina/non-ST elevation MI: A method for prognostication and therapeutic decision making. JAMA. 2000;284(7):835-842. doi:10.1001/jama.284.7.835
Examples
# Example 1: High Risk
# 70yo (+1), Aspirin (+1), Severe Angina (+1), ST changes (+1), Positive Troponin (+1)
# Score = 5
timi_ua_nstemi_score(70, 0, 0, 1, 1, 1, 1)
# Example 2: Low Risk
# 50yo, No Hx, No Aspirin, Angina (+1), No ST changes, Negative Troponin
# Score = 1
timi_ua_nstemi_score(50, 0, 0, 0, 1, 0, 0)
Tisdale Risk Score for QT Prolongation
Description
Calculates the Tisdale Score to predict the risk of QT prolongation (QTc > 500 ms or an increase of >= 60 ms) in hospitalized patients. The score stratifies patients into Low, Moderate, and High risk categories based on clinical risk factors.
Usage
tisdale_qt_score(age, sex, loop_diuretic, serum_potassium, serum_q_t_c, acute_mi,
sepsis, heart_failure, one_qtc_drug, two_or_more_qtc_drugs)
Arguments
age |
Numeric. Patient age in years. (>= 68 years adds 1 point). |
sex |
String. Patient sex ("Male" or "Female"). (Female adds 1 point). |
loop_diuretic |
Numeric (0 or 1). Use of a loop diuretic. (1 = Yes, +1 point). |
serum_potassium |
Numeric. Serum potassium level in mEq/L. (<= 3.5 mEq/L adds 2 points). |
serum_q_t_c |
Numeric. Baseline QTc interval on admission in ms. (>= 450 ms adds 2 points). |
acute_mi |
Numeric (0 or 1). Diagnosis of acute myocardial infarction. (1 = Yes, +2 points). |
sepsis |
Numeric (0 or 1). Diagnosis of sepsis. (1 = Yes, +3 points). |
heart_failure |
Numeric (0 or 1). Diagnosis of heart failure. (1 = Yes, +3 points). |
one_qtc_drug |
Numeric (0 or 1). Administration of exactly one QTc-prolonging drug. (1 = Yes, +3 points). |
two_or_more_qtc_drugs |
Numeric (0 or 1). Administration of two or more QTc-prolonging drugs. (1 = Yes, +3 points). Note: Maximum points for drugs is 3, whether 1 or >=2 drugs are used. The calculator logic checks for >=2 first or applies the same weight. |
Value
A list containing:
Tisdale_Score |
The calculated total score (Range 0-21). |
Risk_Level |
Risk stratification (Low <= 6, Moderate 7-10, High >= 11). |
References
Tisdale JE, Jaynes HA, Kingery JR, et al. Development and validation of a risk score to predict QT interval prolongation in hospitalized patients. Circ Cardiovasc Qual Outcomes. 2013;6(4):479-487. doi:10.1161/CIRCOUTCOMES.113.000152
Examples
# Example 1: High Risk
# Age 70 (1), Female (1), Loop Diuretic (1), K 3.2 (2), QTc 460 (2), HF (3), 1 QT drug (3)
# Score = 13
tisdale_qt_score(70, "female", 1, 3.2, 460, 0, 0, 1, 1, 0)
# Example 2: Low Risk
# Age 50 (0), Male (0), No meds/conditions
# Score = 0
tisdale_qt_score(50, "male", 0, 4.0, 420, 0, 0, 0, 0, 0)
Thoracolumbar Injury Classification and Severity Scale (TLICS)
Description
Calculates the TLICS score to guide the surgical or non-surgical management of thoracolumbar spine trauma. The score is based on three categories: Injury Morphology, Neurological Status, and Integrity of the Posterior Ligamentous Complex (PLC).
Usage
tlics_score(injury_morphology, neurological_status, plc_integrity)
Arguments
injury_morphology |
String. Mechanism/Morphology of injury. "compression": Compression fracture (1 pt). "burst": Burst fracture (2 pts). "translation_rotation": Translational/Rotational injury (3 pts). "distraction": Distraction injury (4 pts). |
neurological_status |
String. Neurological status of the patient. "intact": Neurologically intact (0 pts). "root": Nerve root injury (2 pts). "complete": Complete spinal cord injury (2 pts). "incomplete": Incomplete spinal cord injury (3 pts). "cauda_equina": Cauda Equina Syndrome (3 pts). |
plc_integrity |
String. Status of the Posterior Ligamentous Complex. "intact": Intact (0 pts). "suspected": Injury suspected/Indeterminate (2 pts). "injured": Injured (3 pts). |
Value
A list containing:
TLICS_Score |
The calculated total score (Range 1-10). |
Recommendation |
Clinical management guidance (Non-Operative <= 3, Indeterminate = 4, Operative >= 5). |
References
Vaccaro AR, Lehman RA Jr, Hurlbert RJ, et al. A new classification of thoracolumbar injuries: the importance of injury morphology, the integrity of the posterior ligamentous complex, and neurologic status. Spine (Phila Pa 1976). 2005;30(20):2325-2333. doi:10.1097/01.brs.0000182956.43171.a5
Examples
# Example 1: Non-Operative
# Compression fx (1), Intact Neuro (0), Intact PLC (0)
# Score = 1
tlics_score("compression", "intact", "intact")
# Example 2: Operative
# Burst fx (2), Incomplete Injury (3), Suspected PLC (2)
# Score = 7
tlics_score("burst", "incomplete", "suspected")
Tokyo Guidelines 2018 (TG18) for Acute Cholangitis
Description
Diagnoses and grades the severity of acute cholangitis based on the 2018 Tokyo Guidelines. Diagnosis requires evidence of systemic inflammation, cholestasis, and imaging findings. Severity is graded from I (Mild) to III (Severe) based on organ dysfunction and other risk factors.
Usage
tokyo_guidelines_cholangitis_2018(age, temperature_c, wbc_count, crp_elevated,
bilirubin_mg_dl, abnormal_liver_enzymes,
imaging_biliary_dilation, imaging_etiology,
albumin_g_dl, hypotension_on_meds,
altered_consciousness, pao2_fio2_lt_300,
creatinine_mg_dl, inr, platelet_count_x10_9_l)
Arguments
age |
Numeric. Patient age in years. (>= 75 contributes to Grade II). |
temperature_c |
Numeric. Body temperature in Celsius. (>38 contributes to diagnosis, >=39 contributes to Grade II). |
wbc_count |
Numeric. White Blood Cell count (x10^3/uL). (<4 or >10 contributes to diagnosis; <4 or >12 contributes to Grade II). |
crp_elevated |
Numeric (0 or 1). Is C-Reactive Protein (CRP) >= 1 mg/dL? (1 = Yes). |
bilirubin_mg_dl |
Numeric. Total Bilirubin in mg/dL. (>= 2 contributes to diagnosis; >= 5 contributes to Grade II). |
abnormal_liver_enzymes |
Numeric (0 or 1). Are ALP, GGT, AST, or ALT > 1.5x the upper limit of normal? (1 = Yes). |
imaging_biliary_dilation |
Numeric (0 or 1). Is there biliary dilation on imaging? (1 = Yes). |
imaging_etiology |
Numeric (0 or 1). Is there imaging evidence of etiology (e.g., stricture, stone, stent)? (1 = Yes). |
albumin_g_dl |
Numeric. Serum Albumin in g/dL. (< 0.7 x Lower Limit of Normal contributes to Grade II; standardized to approx < 2.45 g/dL). |
hypotension_on_meds |
Numeric (0 or 1). Hypotension requiring vasopressors? (1 = Yes, Grade III). |
altered_consciousness |
Numeric (0 or 1). Disturbance of consciousness? (1 = Yes, Grade III). |
pao2_fio2_lt_300 |
Numeric (0 or 1). Is PaO2/FiO2 ratio < 300? (1 = Yes, Grade III). |
creatinine_mg_dl |
Numeric. Serum Creatinine in mg/dL. (> 2.0 contributes to Grade III). |
inr |
Numeric. INR. (> 1.5 contributes to Grade III). |
platelet_count_x10_9_l |
Numeric. Platelet count (x10^3/uL). (< 100 contributes to Grade III). |
Value
A list containing:
Diagnosis |
Diagnostic status (No, Suspected, or Definite Acute Cholangitis). |
Severity_Grade |
Severity Classification (Grade I, II, or III) if diagnosed. |
Criteria_Status |
List of booleans indicating which diagnostic criteria (A, B, C) were met. |
References
Kiriyama S, Kozaka K, Takada T, et al. Tokyo Guidelines 2018: diagnostic criteria and severity grading of acute cholangitis (with videos). J Hepatobiliary Pancreat Sci. 2018;25(1):17-30. doi:10.1002/jhbp.512
Examples
# Example 1: Definite Acute Cholangitis, Grade III (Severe)
# Fever, High WBC, High Bili, Dilation, Hypotension
tokyo_guidelines_cholangitis_2018(65, 39.5, 15, 1, 3.0, 1, 1, 1, 3.0, 1, 0, 0, 1.0, 1.0, 150)
# Example 2: Suspected Acute Cholangitis, Grade I (Mild)
# Fever, Abnormal LFTs, No Imaging Findings, Stable Vitals/Labs
tokyo_guidelines_cholangitis_2018(50, 38.5, 9, 0, 1.5, 1, 0, 0, 4.0, 0, 0, 0, 0.8, 1.0, 200)
Tokyo Guidelines 2018 (TG18) for Acute Cholecystitis
Description
Diagnoses and grades the severity of acute cholecystitis based on the 2018 Tokyo Guidelines. The assessment involves three diagnostic criteria categories (Local signs, Systemic signs, Imaging) and specific severity grading criteria based on organ dysfunction and local inflammation.
Usage
tokyo_guidelines_cholecystitis_2018(murphys_sign, ruq_tenderness, temperature_c,
wbc_count, crp_elevated, imaging_positive,
hypotension_meds, altered_consciousness,
pao2_fio2_ratio, creatinine_mg_dl, inr,
platelet_count, palpable_mass, duration_gt_72h,
marked_local_inflammation)
Arguments
murphys_sign |
Numeric (0 or 1). Positive Murphy's sign. (1 = Yes). |
ruq_tenderness |
Numeric (0 or 1). Right upper quadrant tenderness or pain. (1 = Yes). |
temperature_c |
Numeric. Body temperature in Celsius. (> 38.0 contributes to diagnosis). |
wbc_count |
Numeric. White Blood Cell count (x10^3/uL). (> 10 contributes to diagnosis; > 18 contributes to Grade II). |
crp_elevated |
Numeric (0 or 1). Elevated C-Reactive Protein (>= 3 mg/dL). (1 = Yes). |
imaging_positive |
Numeric (0 or 1). Imaging findings characteristic of acute cholecystitis. (1 = Yes). |
hypotension_meds |
Numeric (0 or 1). Hypotension requiring dopamine >= 5 mcg/kg/min or any dose of norepinephrine/dobutamine. (1 = Yes, Grade III). |
altered_consciousness |
Numeric (0 or 1). Disturbance of consciousness. (1 = Yes, Grade III). |
pao2_fio2_ratio |
Numeric. PaO2/FiO2 ratio. (< 300 contributes to Grade III). Use NA if not available. |
creatinine_mg_dl |
Numeric. Serum Creatinine. (> 2.0 mg/dL contributes to Grade III). |
inr |
Numeric. International Normalized Ratio. (> 1.5 contributes to Grade III). |
platelet_count |
Numeric. Platelet count (x10^3/uL). (< 100 contributes to Grade III). |
palpable_mass |
Numeric (0 or 1). Palpable tender mass in the right upper quadrant. (1 = Yes, Grade II). |
duration_gt_72h |
Numeric (0 or 1). Duration of complaints > 72 hours. (1 = Yes, Grade II). |
marked_local_inflammation |
Numeric (0 or 1). Marked local inflammation (e.g., gangrenous/emphysematous cholecystitis, abscess, biliary peritonitis). (1 = Yes, Grade II). |
Value
A list containing:
Diagnosis |
Diagnostic status (No, Suspected, or Definite Acute Cholecystitis). |
Severity_Grade |
Severity Classification (Grade I, II, or III) if diagnosed. |
Criteria_Met |
List indicating which diagnostic criteria categories (A, B, C) were fulfilled. |
References
Yokoe M, Hata J, Takada T, et al. Tokyo Guidelines 2018: diagnostic criteria and severity grading of acute cholecystitis (with videos). J Hepatobiliary Pancreat Sci. 2018;25(1):41-54. doi:10.1002/jhbp.515
Examples
# Example 1: Definite Acute Cholecystitis, Grade II
# Murphy (+), Fever 38.5, WBC 19, Imaging (+), No organ failure, Duration < 72h
tokyo_guidelines_cholecystitis_2018(1, 1, 38.5, 19, 1, 1, 0, 0, 400, 1.0, 1.0, 200, 0, 0, 0)
# Example 2: Suspected Acute Cholecystitis, Grade I
# RUQ pain (+), Fever 38.2, WBC 11, Imaging (-), No severity features
tokyo_guidelines_cholecystitis_2018(0, 1, 38.2, 11, 0, 0, 0, 0, NA, 0.8, 1.0, 250, 0, 0, 0)
Travis Criteria (Oxford Criteria) for Ulcerative Colitis
Description
Calculates the Travis (Oxford) Criteria to predict the failure of intravenous corticosteroid therapy in patients with severe ulcerative colitis. The assessment is performed on Day 3 of treatment. Patients meeting the criteria have a significantly higher risk (approximately 85%) of requiring colectomy.
Usage
travis_uc_criteria(stool_frequency_day3, crp_day3)
Arguments
stool_frequency_day3 |
Numeric. The number of stools passed on Day 3 of IV steroid treatment. |
crp_day3 |
Numeric. The C-reactive protein level (mg/L) on Day 3 of IV steroid treatment. |
Details
The criteria for predicting a high risk of colectomy are:
Stool frequency > 8 times/day OR
Stool frequency > 3 times/day AND CRP > 45 mg/L
Value
A list containing:
Result |
Interpretation of the risk (High vs. Lower). |
Predicted_Colectomy_Rate |
Estimated probability of requiring colectomy. |
References
Travis SP, Farrant JM, Ricketts C, et al. Predicting outcome in severe ulcerative colitis. Gut. 1996;38(6):905-910. doi:10.1136/gut.38.6.905
Examples
# Example 1: High Risk (Frequency > 8)
# 9 stools, CRP 10
travis_uc_criteria(9, 10)
# Example 2: High Risk (Frequency > 3 and CRP > 45)
# 4 stools, CRP 50
travis_uc_criteria(4, 50)
# Example 3: Lower Risk
# 3 stools, CRP 60 (Frequency not > 3)
travis_uc_criteria(3, 60)
TRIP-Cast Score for Thrombosis Risk Prediction
Description
Calculates the TRIP-Cast score to estimate the risk of venous thromboembolism (VTE) in patients with lower limb immobilization (cast or brace). The score stratifies patients into low, moderate, or high risk groups.
Usage
trip_cast_score(age, sex, bmi, oral_contraceptive, vte_history, cancer_history,
cast_below_knee, mobility, surgery)
Arguments
age |
Numeric. Patient age in years. <35: 0 pts. 35-55: 2 pts. >55: 3 pts. |
sex |
String. Patient sex. "Male": +1 pt. "Female": 0 pts. |
bmi |
Numeric. Body Mass Index. <25: 0 pts. 25-30: 1 pt. >30: 2 pts. |
oral_contraceptive |
Numeric (0 or 1). Use of oral contraceptives/hormones. (1 = Yes, +4 pts). |
vte_history |
Numeric (0 or 1). Personal or family history of VTE (or superficial vein thrombosis). (1 = Yes, +5 pts). |
cancer_history |
Numeric (0 or 1). History of cancer. (1 = Yes, +3 pts). |
cast_below_knee |
Numeric (0 or 1). Is the cast/brace strictly below the knee? 1 (Yes): 0 pts. 0 (No/Above knee involvement): +1 pt. |
mobility |
Numeric (0 or 1). Severely restricted mobility (e.g., non-weight bearing). (1 = Yes, +2 pts). |
surgery |
Numeric (0 or 1). Surgery performed or planned. (1 = Yes, +3 pts). |
Value
A list containing:
TRIP_Cast_Score |
The calculated risk score (Range 0-24). |
Risk_Category |
Classification (Low < 7, Moderate 7-11, High >= 12). |
Estimated_VTE_Risk |
Estimated 3-month cumulative VTE incidence. |
References
Nemeth B, van Adrichem RA, van Hylckama Vlieg A, et al. Venous thrombosis risk after cast immobilization of the lower extremity: the TRIP-cast score. Thromb Haemost. 2015;114(6):1242-1249. doi:10.1160/TH15-03-0197
Examples
# Example 1: Low Risk
# 25yo Male, BMI 22, No Hx, Below Knee cast, Partial weight bearing, No Surgery
# Score = 0 (Age) + 1 (Male) + 0 (BMI) + 0 + 0 + 0 + 0 (BK) + 0 (Mobility) + 0 (Surg) = 1
trip_cast_score(25, "male", 22, 0, 0, 0, 1, 0, 0)
# Example 2: High Risk
# 40yo Female, BMI 32, OCP, Hx VTE, Below Knee, Non-weight bearing, No Surg
# Score = 2 (Age) + 0 (Fem) + 2 (BMI) + 4 (OCP) + 5 (Hx) + 0 + 0 + 2 (Mobility) + 0 = 15
trip_cast_score(40, "female", 32, 1, 1, 0, 1, 1, 0)
Trauma Score - Injury Severity Score (TRISS)
Description
Calculates the probability of survival for a trauma patient using the TRISS methodology. This method combines anatomical injury severity (ISS), physiological status (Revised Trauma Score), patient age, and the mechanism of injury to estimate outcomes.
Usage
triss_trauma_score(age, mechanism, gcs, systolic_bp, respiratory_rate, iss)
Arguments
age |
Numeric. Patient age in years. |
mechanism |
String. Mechanism of injury. Options: "blunt" or "penetrating". |
gcs |
Numeric. Glasgow Coma Scale score (3-15). |
systolic_bp |
Numeric. Systolic blood pressure in mmHg. |
respiratory_rate |
Numeric. Respiratory rate in breaths per minute. |
iss |
Numeric. Injury Severity Score (Range 1-75). |
Details
The Revised Trauma Score (RTS) is calculated first using coded values for GCS, SBP, and RR with standard weights:
RTS = 0.9368 \times GCS_c + 0.7326 \times SBP_c + 0.2908 \times RR_c
The probability of survival (P_s) is then calculated using logistic regression coefficients derived from the Major Trauma Outcome Study (MTOS):
P_s = \frac{1}{1 + e^{-b}}
b = b_0 + b_1(RTS) + b_2(ISS) + b_3(AgeIndex)
Where AgeIndex is 1 if Age >= 55, else 0. Coefficients vary by mechanism (Blunt vs. Penetrating).
Value
A list containing:
TRISS_Probability_Survival |
Estimated percentage probability of survival. |
RTS_Calculated |
The calculated Revised Trauma Score used in the model. |
References
Boyd CR, Tolson MA, Copes WS. Evaluating trauma care: the TRISS method. Trauma Score and the Injury Severity Score. J Trauma. 1987;27(4):370-378. Champion HR, Sacco WJ, Copes WS, et al. A revision of the Trauma Score. J Trauma. 1989;29(5):623-629.
Examples
# Example 1: Blunt Trauma, Young, Stable
# Age 30, Blunt, GCS 15, SBP 120, RR 18, ISS 15
triss_trauma_score(30, "blunt", 15, 120, 18, 15)
# Example 2: Penetrating Trauma, Older, Unstable
# Age 60, Penetrating, GCS 10, SBP 85, RR 32, ISS 30
triss_trauma_score(60, "penetrating", 10, 85, 32, 30)
Truelove and Witts Severity Index for Ulcerative Colitis
Description
Calculates the Truelove and Witts Severity Index to classify the severity of an Ulcerative Colitis flare. The classification is based on six criteria: stool frequency, rectal bleeding, temperature, pulse, hemoglobin, and ESR.
Usage
truelove_witts_severity_index(bowel_movements_per_day, rectal_bleeding,
temperature_c, heart_rate, hemoglobin_g_dl, esr)
Arguments
bowel_movements_per_day |
Numeric. Number of bowel movements per day. |
rectal_bleeding |
String. Presence of blood in stool. Options: "none" (small/none), "intermittent", "frequent_continuous" (visible blood). |
temperature_c |
Numeric. Body temperature in degrees Celsius. (> 37.5 C is a severe criterion). |
heart_rate |
Numeric. Pulse rate in beats per minute. (> 90 bpm is a severe criterion). |
hemoglobin_g_dl |
Numeric. Hemoglobin level in g/dL. (<= 10.5 g/dL is a severe criterion). |
esr |
Numeric. Erythrocyte Sedimentation Rate in mm/hr. (> 30 mm/hr is a severe criterion). |
Details
Classification logic: - **Severe**: >= 6 bloody stools/day AND at least one sign of systemic toxicity (Temp > 37.5, HR > 90, Hgb <= 10.5, or ESR > 30). - **Mild**: < 4 stools/day, with no or intermittent bleeding, and normal vital signs/labs. - **Moderate**: Intermediate between Mild and Severe (e.g., > 4 stools but not meeting severe criteria).
Value
A list containing:
Severity_Index |
The severity classification (Mild, Moderate, Severe). |
References
Truelove SC, Witts LJ. Cortisone in ulcerative colitis; final report on a therapeutic trial. Br Med J. 1955;2(4947):1041-1048. doi:10.1136/bmj.2.4947.1041
Examples
# Example 1: Severe Colitis
# 8 stools, frequent blood, HR 100, Temp 38
truelove_witts_severity_index(8, "frequent_continuous", 38.0, 100, 11.0, 25)
# Example 2: Mild Colitis
# 3 stools, intermittent blood, normal vitals/labs
truelove_witts_severity_index(3, "intermittent", 37.0, 70, 14.0, 10)
Trunk Impairment Scale (TIS)
Description
Calculates the Trunk Impairment Scale (TIS) score, a tool used to evaluate motor impairment of the trunk after stroke. The scale assesses static sitting balance, dynamic sitting balance, and trunk coordination. The total score ranges from 0 to 23, with higher scores indicating better trunk performance.
Usage
trunk_impairment_scale(static_sitting_balance, dynamic_sitting_balance,
coordination)
Arguments
static_sitting_balance |
Numeric (0-7). Score for static sitting balance. Includes items like ability to sit without support and maintain position. |
dynamic_sitting_balance |
Numeric (0-10). Score for dynamic sitting balance. Includes items like touching the bed/mat with the elbow (lateral flexion) initiated from the upper and lower trunk. |
coordination |
Numeric (0-6). Score for trunk coordination. Includes items like rotation of the shoulder girdle and pelvic girdle. |
Value
A list containing:
TIS_Total_Score |
The calculated total score (Range 0-23). |
Interpretation |
General interpretation of the score. |
Subscale_Scores |
Breakdown of scores for each subscale. |
References
Verheyden G, Nieuwboer A, Mertin J, et al. The Trunk Impairment Scale: a new tool to measure motor impairment of the trunk after stroke. Clin Rehabil. 2004;18(3):326-334. doi:10.1191/0269215504cr733oa
Examples
# Example 1: Moderate Impairment
# Static: 5/7, Dynamic: 4/10, Coordination: 2/6
# Total = 11
trunk_impairment_scale(5, 4, 2)
# Example 2: Minimal Impairment
# Static: 7/7, Dynamic: 9/10, Coordination: 5/6
# Total = 21
trunk_impairment_scale(7, 9, 5)
Testicular Workup for Ischemia and Suspected Torsion (TWIST) Score
Description
Calculates the TWIST Score to stratify the risk of testicular torsion in male patients presenting with acute scrotal pain. The score helps identify patients who may require immediate surgical exploration versus those who can be safely managed with ultrasound or clinical observation.
Usage
twist_score(testicular_swelling, hard_testicle, absent_cremasteric_reflex,
nausea_vomiting, high_riding_testicle)
Arguments
testicular_swelling |
Numeric (0 or 1). Presence of testicular swelling. (1 = Yes, +2 points). |
hard_testicle |
Numeric (0 or 1). Presence of a hard testicle on palpation. (1 = Yes, +2 points). |
absent_cremasteric_reflex |
Numeric (0 or 1). Absence of the cremasteric reflex. (1 = Yes, +1 point). |
nausea_vomiting |
Numeric (0 or 1). Nausea or vomiting. (1 = Yes, +1 point). |
high_riding_testicle |
Numeric (0 or 1). High-riding testicle. (1 = Yes, +1 point). |
Value
A list containing:
TWIST_Score |
The calculated total score (Range 0-7). |
Risk_Category |
Classification (Low: 0-2, Intermediate: 3-4, High: 5-7). |
Recommendation |
Clinical guidance regarding imaging and consultation. |
References
Barbosa JA, Tiseo BC, Barayan GA, et al. Development and initial validation of a scoring system to diagnose testicular torsion in children. J Urol. 2013;189(5):1859-1864. doi:10.1016/j.juro.2012.10.056
Examples
# Example 1: High Risk
# Swelling (1), Hard (1), No Reflex (1), Nausea (0), High Riding (0)
# Score = 2 + 2 + 1 = 5
twist_score(1, 1, 1, 0, 0)
# Example 2: Low Risk
# No swelling, soft testicle, reflex present (0), nausea (1), normal position
# Score = 1
twist_score(0, 0, 0, 1, 0)
Ulcerative Colitis Endoscopic Index of Severity (UCEIS)
Description
Calculates the UCEIS score, a validated instrument for assessing endoscopic disease activity in Ulcerative Colitis. The score is the sum of three descriptors: vascular pattern, bleeding, and erosions/ulcers. The total score ranges from 0 to 8.
Usage
uceis_score(vascular_pattern, bleeding, erosions_ulcers)
Arguments
vascular_pattern |
Numeric (0-2). Assessment of vascular pattern. 0: Normal. 1: Patchy obliteration. 2: Obliterated. |
bleeding |
Numeric (0-3). Assessment of bleeding. 0: None. 1: Mucosal. 2: Luminal mild. 3: Luminal moderate or severe. |
erosions_ulcers |
Numeric (0-3). Assessment of erosions and ulcers. 0: None. 1: Erosions. 2: Superficial ulcer. 3: Deep ulcer. |
Value
A list containing:
UCEIS_Score |
The calculated total score (Range 0-8). |
Disease_Activity |
Interpretation of severity (Remission <=1, Moderate-Severe >4). |
References
Travis SP, Schnell D, Krzeski P, et al. Developing an instrument to assess the endoscopic severity of ulcerative colitis: the Ulcerative Colitis Endoscopic Index of Severity (UCEIS). Gut. 2012;61(4):535-542. doi:10.1136/gutjnl-2011-300207 Ikeya K, Shih DQ, Takano R, et al. Correlating the Ulcerative Colitis Endoscopic Index of Severity with Clinical Outcomes: A Prospective Study. Dig Dis Sci. 2016;61(10):2983-2990.
Examples
# Example 1: Severe Disease
# Obliterated vascular (2), Luminal mild bleeding (2), Deep ulcers (3)
# Score = 7
uceis_score(2, 2, 3)
# Example 2: Remission
# Normal vascular (0), No bleeding (0), No erosions (0)
# Score = 0
uceis_score(0, 0, 0)
UCSF CAPRA Score for Prostate Cancer Risk
Description
Calculates the UCSF CAPRA (Cancer of the Prostate Risk Assessment) Score to predict pathological outcomes and recurrence-free survival after radical prostatectomy. The score utilizes preoperative PSA, Gleason score, clinical T stage, percent positive biopsy cores, and age.
Usage
ucsf_capra_score(psa, gleason_primary, gleason_secondary, clinical_t_stage,
percent_positive_cores, age)
Arguments
psa |
Numeric. Preoperative PSA level in ng/mL. |
gleason_primary |
Numeric. The primary Gleason pattern (1-5). |
gleason_secondary |
Numeric. The secondary Gleason pattern (1-5). |
clinical_t_stage |
String. Clinical T stage. "t1" or "t2": 0 points. "t3a": 1 point. |
percent_positive_cores |
Numeric. Percentage of biopsy cores positive for cancer (0-100). |
age |
Numeric. Patient age in years. |
Value
A list containing:
CAPRA_Score |
The calculated total score (Range 0-10). |
Risk_Category |
Risk classification (Low: 0-2, Intermediate: 3-5, High: 6-10). |
Est_5_Year_Recurrence_Free_Survival |
Estimated percentage of patients recurrence-free at 5 years post-prostatectomy. |
References
Cooperberg MR, Pasta DJ, Elkin EP, et al. The University of California, San Francisco Cancer of the Prostate Risk Assessment score: a straightforward and reliable preoperative predictor of disease recurrence after radical prostatectomy. J Urol. 2005;173(6):1938-1942. doi:10.1097/01.ju.0000158155.33890.e7
Examples
# Example 1: Low Risk
# PSA 5, Gleason 3+3, T1c, 20% cores, Age 45
# Score = 0
ucsf_capra_score(5, 3, 3, "t1", 20, 45)
# Example 2: High Risk
# PSA 25, Gleason 4+3, T3a, 50% cores, Age 65
# Score = 3(PSA) + 3(Gleason) + 1(Stage) + 1(Cores) + 1(Age) = 9
ucsf_capra_score(25, 4, 3, "t3a", 50, 65)
UCLA Integrated Staging System (UISS) for Renal Cell Carcinoma
Description
Calculates the UISS risk stratification for patients with Renal Cell Carcinoma (RCC). The system divides patients into Localized or Metastatic disease categories and then stratifies them into Low, Intermediate, or High risk groups based on TNM stage, Fuhrman nuclear grade, and ECOG performance status to predict 5-year survival.
Usage
uiss_rcc_staging(tnm_t_stage, tnm_n_stage, tnm_m_stage, fuhrman_grade,
ecog_performance_status)
Arguments
tnm_t_stage |
String. The TNM T-stage of the tumor (1997 classification). Options: "t1", "t2", "t3", "t4". |
tnm_n_stage |
String. The TNM N-stage. Options: "n0" (No lymph nodes), "n1", "n2" (Positive lymph nodes). |
tnm_m_stage |
String. The TNM M-stage. Options: "m0" (No distant metastasis), "m1" (Distant metastasis). |
fuhrman_grade |
Numeric. Fuhrman nuclear grade (1, 2, 3, or 4). |
ecog_performance_status |
Numeric. ECOG Performance Status score (0-4). |
Value
A list containing:
UISS_Risk_Group |
The calculated risk group (Low, Intermediate, or High) appended with the disease state (Localized vs Metastatic). |
Est_5_Year_Survival |
Estimated 5-year cancer-specific survival based on the risk group. |
References
Zisman A, Pantuck AJ, Wieder J, et al. Risk group assessment and clinical outcome algorithm to predict the natural history of patients with surgically resected renal cell carcinoma. J Clin Oncol. 2002;20(23):4559-4566. doi:10.1200/JCO.2002.05.111
Examples
uiss_rcc_staging("t1", "n0", "m0", 1, 0)
uiss_rcc_staging("t3", "n1", "m0", 3, 1)
United Kingdom Model for End-Stage Liver Disease (UKELD)
Description
Calculates the UKELD score, used in the United Kingdom to assess the severity of chronic liver disease and determine eligibility for liver transplantation listing. A UKELD score of 49 or greater typically indicates a 1-year mortality risk of approximately 9%, which is considered the minimum threshold for listing.
Usage
ukeld_score(bilirubin_umol_l, inr, creatinine_umol_l, sodium_mmol_l)
Arguments
bilirubin_umol_l |
Numeric. Serum Bilirubin level in micromol/L. (Note: UKELD uses micromol/L, unlike MELD which often uses mg/dL). |
inr |
Numeric. International Normalized Ratio. |
creatinine_umol_l |
Numeric. Serum Creatinine level in micromol/L. |
sodium_mmol_l |
Numeric. Serum Sodium level in mmol/L. |
Details
The formula is:
UKELD = (5.395 \times \ln(INR)) + (1.266 \times \ln(Bilirubin)) + (1.541 \times \ln(Creatinine)) + (1.567 \times \ln(Sodium))
Values for Bilirubin, INR, and Creatinine are capped at a minimum of 1.0 to avoid negative logarithms.
Value
A list containing:
UKELD_Score |
The calculated score (rounded to the nearest integer). |
Listing_Criteria |
Indication of whether the score meets the minimum threshold for transplant listing. |
Est_1_Year_Mortality_Without_Transplant |
Estimated 1-year mortality percentage. |
References
Barber K, et al. The UKELD score: validation of a new scoring system for liver transplantation in the UK. Neuberger J, Gimson A, Davies M, et al. Selection of patients for liver transplantation and allocation of donated livers in the UK. Gut. 2008;57(2):252-257. doi:10.1136/gut.2007.131730
Examples
# Example 1: Meets Listing Criteria
# Bili 50, INR 1.5, Cr 100, Na 135
ukeld_score(50, 1.5, 100, 135)
# Example 2: Below Listing Criteria
# Bili 15, INR 1.1, Cr 70, Na 140
ukeld_score(15, 1.1, 70, 140)
Urine Output Calculator
Description
Calculates urine output normalized by patient weight and time (mL/kg/hr). This metric is critical for assessing renal perfusion, fluid balance, and identifying oliguria or acute kidney injury.
Usage
urine_output_calculator(urine_volume_ml, time_hours, weight_kg)
Arguments
urine_volume_ml |
Numeric. Total volume of urine produced in milliliters. |
time_hours |
Numeric. Duration of collection in hours. |
weight_kg |
Numeric. Patient weight in kilograms. |
Details
The formula is:
Output (mL/kg/hr) = \frac{Total Volume (mL)}{Time (hr) \times Weight (kg)}
Standard thresholds for oliguria: - Adults: < 0.5 mL/kg/hr - Children: < 1.0 mL/kg/hr - Infants: < 2.0 mL/kg/hr
Value
A list containing:
Urine_Output_mL_kg_hr |
The normalized urine output. |
Hourly_Rate_mL_hr |
The average hourly urine production. |
Interpretation_Adult |
Classification based on the adult threshold of 0.5 mL/kg/hr. |
References
Kellum JA, Lameire N, KDIGO AKI Guideline Work Group. Diagnosis, evaluation, and management of acute kidney injury: a KDIGO summary (Part 1). Crit Care. 2013;17(1):204. doi:10.1186/cc11454
Examples
# Example 1: Oliguria
# 200 mL over 6 hours, 80 kg
# Rate = 200/6 = 33.3 mL/hr. Normalized = 33.3/80 = 0.42 mL/kg/hr
urine_output_calculator(200, 6, 80)
# Example 2: Adequate Output
# 1000 mL over 12 hours, 70 kg
# Rate = 83.3 mL/hr. Normalized = 1.19 mL/kg/hr
urine_output_calculator(1000, 12, 70)
Urticaria Activity Score (UAS)
Description
Calculates the daily Urticaria Activity Score (UAS) to assess the disease activity of chronic spontaneous urticaria. The score is the sum of the daily wheal score and the daily pruritus score.
Usage
urticaria_activity_score(wheals_score, pruritus_score)
Arguments
wheals_score |
Numeric (0-3). Assessment of number of wheals. 0: None. 1: Mild (< 20 wheals/24h). 2: Moderate (20-50 wheals/24h). 3: Intense (> 50 wheals/24h or large confluent areas of wheals). |
pruritus_score |
Numeric (0-3). Assessment of intensity of itch. 0: None. 1: Mild (Present but not annoying or troublesome). 2: Moderate (Troublesome but does not interfere with normal daily activity or sleep). 3: Intense (Severe, sufficiently troublesome to interfere with normal daily activity or sleep). |
Value
A list containing:
UAS_Daily_Score |
The calculated daily score (Range 0-6). |
Interpretation |
Context for the score range. |
References
Zuberbier T, Aberer W, Asero R, et al. The EAACI/GA²LEN/EDF/WAO guideline for the definition, classification, diagnosis and management of urticaria. Allergy. 2018;73(7):1393-1414. doi:10.1111/all.13397
Examples
# Example 1: Moderate Disease
# Moderate wheals (2), Mild itch (1)
# Score = 3
urticaria_activity_score(2, 1)
# Example 2: Severe Disease
# Intense wheals (3), Intense itch (3)
# Score = 6
urticaria_activity_score(3, 3)
US MEDPED Diagnostic Criteria for Familial Hypercholesterolemia (FH)
Description
Calculates the US MEDPED (Make Early Diagnosis to Prevent Early Deaths) diagnostic criteria for Familial Hypercholesterolemia. The diagnosis is based on age-specific total cholesterol thresholds and the degree of relationship to a known relative with FH.
Usage
us_medped_fh_criteria(age, total_cholesterol, relative_with_fh, units = "mg/dL")
Arguments
age |
Numeric. Patient age in years. |
total_cholesterol |
Numeric. Total cholesterol level. |
relative_with_fh |
String. The degree of relationship to a relative diagnosed with FH. Options: "first_degree" (Parent, Sibling, Child). "second_degree" (Grandparent, Aunt/Uncle, Niece/Nephew, Half-sibling). "third_degree" (First Cousin). "general_population" (No known relative with FH). |
units |
String. Units for cholesterol input. Options: "mg/dL" (default) or "mmol/L". |
Details
Thresholds (mg/dL) for diagnosis: First Degree: <20y (220), 20-29y (240), 30-39y (270), >=40y (290). Second Degree: <20y (230), 20-29y (250), 30-39y (280), >=40y (300). Third Degree: <20y (240), 20-29y (260), 30-39y (290), >=40y (310). General Population: <20y (270), 20-29y (290), 30-39y (340), >=40y (360).
Value
A list containing:
Diagnosis |
"Diagnosed with Familial Hypercholesterolemia (FH)" or "Does Not Meet Criteria for FH". |
Threshold_Used_mg_dL |
The specific cholesterol cutoff used for the assessment. |
References
Williams RR, Hunt SC, Schumacher MC, et al. Diagnosing heterozygous familial hypercholesterolemia using new practical criteria validated by molecular genetics. Am J Cardiol. 1993;72(2):171-176. doi:10.1016/0002-9149(93)90155-6
Examples
# Example 1: FH Diagnosed
# 35yo, Cholesterol 300 mg/dL, First-degree relative with FH
us_medped_fh_criteria(35, 300, "first_degree")
# Example 2: Not FH
# 50yo, Cholesterol 250 mg/dL, General Population
us_medped_fh_criteria(50, 250, "general_population")
Utah COVID-19 Risk Score
Description
Calculates the Utah COVID-19 Risk Score to predict the probability of hospitalization in patients with COVID-19. The score uses age, sex, and comorbidities to stratify patients into Low, Medium, or High risk categories.
Usage
utah_covid_risk_score(age, sex, congestive_heart_failure, copd, diabetes,
hypertension, immunosuppression)
Arguments
age |
Numeric. Patient age in years. 18-39: 0 pts 40-49: 1 pt 50-59: 2 pts 60-69: 3 pts 70-79: 4 pts >=80: 5 pts |
sex |
String. Patient sex ("Male" or "Female"). (Male: +1 pt). |
congestive_heart_failure |
Numeric (0 or 1). History of congestive heart failure. (1 = Yes, +1 pt). |
copd |
Numeric (0 or 1). History of COPD. (1 = Yes, +1 pt). |
diabetes |
Numeric (0 or 1). History of diabetes. (1 = Yes, +1 pt). |
hypertension |
Numeric (0 or 1). History of hypertension. (1 = Yes, +1 pt). |
immunosuppression |
Numeric (0 or 1). Immunocompromised state (e.g., cancer treatment, solid organ transplant, immunodeficiencies). (1 = Yes, +1 pt). |
Value
A list containing:
Utah_Risk_Score |
The calculated total score (Range 0-11). |
Risk_Level |
Risk classification (Low <= 0, Medium 1-2, High >= 3). |
References
Knight SR, Ho A, Pius R, et al. Risk stratification of patients admitted to hospital with covid-19 using the ISARIC WHO Clinical Characterisation Protocol: development and validation of the 4C Mortality Score. BMJ. 2020;370:m3339. (Context of similar risk stratification approaches). Review of Utah Healthcare Guidance.
Examples
# Example 1: High Risk
# 75yo Male (+4 Age, +1 Sex), Hypertension (+1)
# Score = 6
utah_covid_risk_score(75, "male", 0, 0, 0, 1, 0)
# Example 2: Low Risk
# 30yo Female, No comorbidities
# Score = 0
utah_covid_risk_score(30, "female", 0, 0, 0, 0, 0)
Veterans Health Administration COVID-19 (VACO) Index
Description
Calculates the VACO Index to estimate the 30-day all-cause mortality risk for patients with COVID-19. The index is based on age, sex, and the Charlson Comorbidity Index (CCI) components.
Usage
vaco_index_score(age, sex, myocardial_infarction, congestive_heart_failure,
peripheral_vascular_disease, cerebrovascular_disease, dementia,
chronic_pulmonary_disease, rheumatologic_disease,
peptic_ulcer_disease, liver_disease, diabetes, hemiplegia,
renal_disease, cancer, aids)
Arguments
age |
Numeric. Patient age in years. |
sex |
String. "male" or "female". |
myocardial_infarction |
Numeric (0 or 1). History of myocardial infarction. |
congestive_heart_failure |
Numeric (0 or 1). History of congestive heart failure. |
peripheral_vascular_disease |
Numeric (0 or 1). History of peripheral vascular disease. |
cerebrovascular_disease |
Numeric (0 or 1). History of cerebrovascular disease (e.g., stroke or TIA). |
dementia |
Numeric (0 or 1). History of dementia. |
chronic_pulmonary_disease |
Numeric (0 or 1). History of chronic pulmonary disease (e.g., COPD). |
rheumatologic_disease |
Numeric (0 or 1). History of connective tissue disease. |
peptic_ulcer_disease |
Numeric (0 or 1). History of peptic ulcer disease. |
liver_disease |
String. "none", "mild" (chronic hepatitis or cirrhosis without portal hypertension), or "moderate_severe" (cirrhosis with portal hypertension or varices). |
diabetes |
String. "none", "uncomplicated", or "complicated" (end-organ damage). |
hemiplegia |
Numeric (0 or 1). History of hemiplegia or paraplegia. |
renal_disease |
Numeric (0 or 1). Moderate to severe renal disease. |
cancer |
String. "none", "localized" (any tumor, leukemia, lymphoma), or "metastatic" (metastatic solid tumor). |
aids |
Numeric (0 or 1). History of AIDS. |
Value
A list containing:
VACO_Index_Mortality_30_Day |
The estimated 30-day mortality percentage. |
Inputs |
A summary of the provided inputs and the calculated Charlson Comorbidity Index (CCI) score. |
References
King JT Jr, Yoon JS, Rentsch CT, et al. Development and validation of a 30-day mortality index based on pre-existing medical administrative data from 13,323 COVID-19 patients: The Veterans Health Administration COVID-19 (VACO) Index. PLoS One. 2020;15(11):e0241825. doi:10.1371/journal.pone.0241825
Examples
# Example 1: High Risk
# 75yo Male, Complicated Diabetes, CHF
vaco_index_score(75, "male", 0, 1, 0, 0, 0, 0, 0, 0, "none", "complicated", 0, 0, "none", 0)
# Example 2: Low Risk
# 40yo Female, No comorbidities
vaco_index_score(40, "female", 0, 0, 0, 0, 0, 0, 0, 0, "none", "none", 0, 0, "none", 0)
Veterans Aging Cohort Study (VACS) 1.0 Index
Description
Calculates the VACS Index 1.0 score to estimate the risk of all-cause mortality in patients with HIV. The score integrates age, HIV-specific biomarkers (CD4, Viral Load), and general organ system injury markers (Hemoglobin, FIB-4 for liver fibrosis, eGFR for renal function, and Hepatitis C status).
Usage
vacs_1_0_index(age, cd4_count, hiv_rna, hemoglobin, platelets, ast, alt,
creatinine, hepatitis_c_positive, sex = "male", race = "other")
Arguments
age |
Numeric. Patient age in years. |
cd4_count |
Numeric. CD4 T-cell count (cells/mm^3). |
hiv_rna |
Numeric. HIV-1 RNA viral load (copies/mL). |
hemoglobin |
Numeric. Hemoglobin level (g/dL). |
platelets |
Numeric. Platelet count (x10^3/uL or x10^9/L). |
ast |
Numeric. Aspartate Aminotransferase (AST) level (U/L). |
alt |
Numeric. Alanine Aminotransferase (ALT) level (U/L). |
creatinine |
Numeric. Serum Creatinine level (mg/dL). |
hepatitis_c_positive |
Numeric (0 or 1). Hepatitis C virus (HCV) status (1 = Positive). |
sex |
String. Patient sex ("male" or "female"). Used for eGFR calculation. |
race |
String. Patient race ("black", "african american", "other"). Used for eGFR calculation (MDRD). |
Value
A list containing:
VACS_Index_Score |
The calculated total score (Range 0 to ~164). |
Calculated_Values |
Derived FIB-4 and eGFR values used in the score. |
References
Justice AC, Modur SP, Tate JP, et al. Predictive accuracy of the Veterans Aging Cohort Study (VACS) Index for mortality with HIV infection: a North American cross cohort analysis. J Acquir Immune Defic Syndr. 2013;62(2):149-163. doi:10.1097/QAI.0b013e31827df36c
Examples
# Example 1: Low Risk
# 40yo, CD4 600, VL <500, Hgb 15, Plt 250, AST 20, ALT 20, Cr 0.9, HCV-
vacs_1_0_index(40, 600, 400, 15, 250, 20, 20, 0.9, 0)
# Example 2: High Risk
# 55yo (+12), CD4 150 (+10), VL 50k (+7), Hgb 11 (+22), FIB-4 >3.25 (+25), eGFR <30 (+26), HCV+ (+5)
# Approx calculation: 55y, CD4 150, VL 50000, Hgb 11, Plt 100, AST 100, ALT 40, Cr 3.0, HCV+
vacs_1_0_index(55, 150, 50000, 11, 100, 100, 40, 3.0, 1, "male", "black")
Veterans Aging Cohort Study (VACS) 2.0 Index
Description
Calculates the VACS Index 2.0 score to estimate the risk of 5-year all-cause mortality in patients with HIV. This updated model incorporates additional variables (albumin, WBC, BMI) and uses continuous functions for laboratory values to improve predictive accuracy over the original VACS Index 1.0.
Usage
vacs_2_0_index(age, cd4_count, hiv_rna, hemoglobin, fib4_index, egfr,
hepatitis_c_positive, albumin, wbc_count, bmi,
sex = "male", race = "other")
Arguments
age |
Numeric. Patient age in years. |
cd4_count |
Numeric. CD4 T-cell count (cells/mm^3). |
hiv_rna |
Numeric. HIV-1 RNA viral load (copies/mL). |
hemoglobin |
Numeric. Hemoglobin level (g/dL). |
fib4_index |
Numeric. FIB-4 Index for Liver Fibrosis. |
egfr |
Numeric. Estimated Glomerular Filtration Rate (mL/min/1.73m^2). |
hepatitis_c_positive |
Numeric (0 or 1). Hepatitis C virus (HCV) status (1 = Positive). |
albumin |
Numeric. Serum Albumin level (g/dL). |
wbc_count |
Numeric. White Blood Cell count (x10^3/uL). |
bmi |
Numeric. Body Mass Index (kg/m^2). |
sex |
String. Patient sex ("male" or "female"). (Not explicitly weighted in published general model but typically collected). |
race |
String. Patient race ("black", "other"). (Not explicitly weighted in published general model but typically collected). |
Value
A list containing:
VACS_2_0_Index |
The calculated risk score (higher scores indicate greater mortality risk). |
Est_5_Year_Mortality |
Estimated probability of 5-year all-cause mortality. |
References
Tate JP, et al. An internationally generalizable risk index for mortality after one year of antiretroviral therapy. AIDS. 2013;27(4):563-572. Justice AC, et al. A prognostic index for HIV-associated mortality.
Examples
# Example 1: Low Risk
# 40yo, CD4 600, VL 50, Hgb 15, FIB4 1.0, eGFR 100, HCV-, Alb 4.2, WBC 6.0, BMI 26
vacs_2_0_index(40, 600, 50, 15, 1.0, 100, 0, 4.2, 6.0, 26)
# Example 2: High Risk
# 60yo, CD4 200, VL 50000, Hgb 11, FIB4 3.5, eGFR 45, HCV+, Alb 3.0, WBC 4.0, BMI 22
vacs_2_0_index(60, 200, 50000, 11, 3.5, 45, 1, 3.0, 4.0, 22)
Veterans Aging Cohort Study - Charlson Comorbidity Index (VACS-CCI)
Description
Calculates the VACS-CCI score, which adapts the Charlson Comorbidity Index for use in HIV-positive populations (and general populations) within the Veterans Aging Cohort Study context. It predicts all-cause mortality by summing weights for age and 17 specific comorbid conditions.
Usage
vacs_cci_score(age, sex, metastatic_cancer, aids, mild_liver_disease,
moderate_severe_liver_disease, chronic_pulmonary_disease,
dementia, hemiplegia, severe_kidney_disease, mild_kidney_disease,
history_mi, congestive_heart_failure, peripheral_vascular_disease,
cerebrovascular_disease, peptic_ulcer_disease,
diabetes_uncomplicated, diabetes_complicated, rheumatic_disease,
non_metastatic_cancer)
Arguments
age |
Numeric. Patient age in years. <50: 0 pts. 50-59: +1 pt. 60-69: +2 pts. 70-79: +3 pts. >=80: +4 pts. |
sex |
String. Patient sex ("male" or "female"). (Not weighted in score but part of demographic input). |
metastatic_cancer |
Numeric (0 or 1). Metastatic solid tumor. (1 = Yes, +6 pts). |
aids |
Numeric (0 or 1). AIDS diagnosis (not just HIV+). (1 = Yes, +6 pts). |
mild_liver_disease |
Numeric (0 or 1). Mild liver disease (e.g., chronic hepatitis, cirrhosis without portal hypertension). (1 = Yes, +2 pts). (Do not count if Moderate/Severe selected). |
moderate_severe_liver_disease |
Numeric (0 or 1). Moderate to severe liver disease (e.g., cirrhosis with portal hypertension, varices). (1 = Yes, +3 pts). |
chronic_pulmonary_disease |
Numeric (0 or 1). Chronic pulmonary disease (COPD). (1 = Yes, +1 pt). |
dementia |
Numeric (0 or 1). Dementia. (1 = Yes, +1 pt). |
hemiplegia |
Numeric (0 or 1). Hemiplegia or paraplegia. (1 = Yes, +2 pts). |
severe_kidney_disease |
Numeric (0 or 1). Moderate to severe kidney disease. (1 = Yes, +2 pts). |
mild_kidney_disease |
Numeric (0 or 1). Mild kidney disease. (1 = Yes, +1 pt). (Do not count if Severe selected). |
history_mi |
Numeric (0 or 1). Myocardial infarction. (1 = Yes, +1 pt). |
congestive_heart_failure |
Numeric (0 or 1). Congestive heart failure. (1 = Yes, +1 pt). |
peripheral_vascular_disease |
Numeric (0 or 1). Peripheral vascular disease. (1 = Yes, +1 pt). |
cerebrovascular_disease |
Numeric (0 or 1). Cerebrovascular disease. (1 = Yes, +1 pt). |
peptic_ulcer_disease |
Numeric (0 or 1). Peptic ulcer disease. (1 = Yes, +1 pt). |
diabetes_uncomplicated |
Numeric (0 or 1). Diabetes without chronic complications. (1 = Yes, +1 pt). |
diabetes_complicated |
Numeric (0 or 1). Diabetes with chronic complications. (1 = Yes, +2 pts). (Do not count Uncomplicated if Complicated selected). |
rheumatic_disease |
Numeric (0 or 1). Connective tissue/Rheumatic disease. (1 = Yes, +1 pt). |
non_metastatic_cancer |
Numeric (0 or 1). Any malignancy (including lymphoma/leukemia), except metastatic solid tumor or non-melanoma skin cancer. (1 = Yes, +2 pts). |
Value
A list containing:
VACS_CCI_Score |
The calculated total score. |
Interpretation |
Context regarding mortality risk prediction. |
References
Charlson ME, Pompei P, Ales KL, MacKenzie CR. A new method of classifying prognostic comorbidity in longitudinal studies: development and validation. J Chronic Dis. 1987;40(5):373-383. doi:10.1016/0021-9681(87)90171-8 Justice AC, et al. (Veterans Aging Cohort Study).
Examples
# Example 1: High Risk
# 65yo (+2), Metastatic Cancer (+6), COPD (+1)
# Score = 9
vacs_cci_score(65, "male", 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
# Example 2: Low Risk
# 45yo (0), Uncomplicated Diabetes (+1)
# Score = 1
vacs_cci_score(45, "female", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0)
Vancouver Chest Pain Rule
Description
Applies the Vancouver Chest Pain Rule algorithm to identify patients with chest pain who are at low risk for Acute Coronary Syndrome (ACS) and can be safely discharged. The rule utilizes a decision tree based on ECG findings, history, age, and pain characteristics.
Usage
vancouver_chest_pain_rule(age, prior_acs_nitrate_use, ecg_st_depression,
ecg_non_specific_repolarization, troponin_elevated,
pain_worse_palpation)
Arguments
age |
Numeric. Patient age in years. |
prior_acs_nitrate_use |
Numeric (0 or 1). Does the patient have a prior history of ACS or use nitrates? (1 = Yes). |
ecg_st_depression |
Numeric (0 or 1). Presence of ST-segment depression (> 0.5 mm) on ECG? (1 = Yes). |
ecg_non_specific_repolarization |
Numeric (0 or 1). Presence of non-specific repolarization changes on ECG? (1 = Yes). |
troponin_elevated |
Numeric (0 or 1). Is the troponin level elevated (positive) at 0 or 2 hours? (1 = Yes). |
pain_worse_palpation |
Numeric (0 or 1). Does palpation reproduce the pain? (1 = Yes). |
Value
A list containing:
Result |
Clinical interpretation (Low Risk vs Not Low Risk). |
Risk_Category |
Categorical risk assessment. |
References
Cullen L, Greenslade JH, Than M, et al. Validation of the Vancouver Chest Pain Rule using troponin as the only biomarker: a prospective cohort study. Am J Emerg Med. 2014;32(2):114-121. doi:10.1016/j.ajem.2013.10.021
Examples
# Example 1: Low Risk (No Hx, Age < 50)
vancouver_chest_pain_rule(40, 0, 0, 0, 0, 0)
# Example 2: Not Low Risk (Age 60, No reproducible pain)
vancouver_chest_pain_rule(60, 0, 0, 0, 0, 0)
# Example 3: Low Risk (Hx ACS, but pain reproducible)
vancouver_chest_pain_rule(60, 1, 0, 0, 0, 1)
Vaginal Birth After Cesarean (VBAC) Success Predictor (MFMU 2021 Model)
Description
Calculates the predicted probability of a successful vaginal birth after cesarean (VBAC) for women with one prior low-transverse cesarean section. This function uses the updated 2021 MFMU Network model which excludes race and ethnicity variables, incorporating age, BMI, prior vaginal delivery history, recurring indication for prior cesarean, and history of chronic hypertension.
Usage
vbac_success_predictor(age, height_in, weight_lb, previous_vaginal_delivery,
previous_vbac, recurring_indication_cesarean,
treated_chronic_hypertension)
Arguments
age |
Numeric. Maternal age in years. |
height_in |
Numeric. Maternal height in inches. |
weight_lb |
Numeric. Pre-pregnancy weight in pounds. |
previous_vaginal_delivery |
Numeric (0 or 1). Has the patient had any prior vaginal delivery (either before or after the cesarean)? (1 = Yes). |
previous_vbac |
Numeric (0 or 1). Has the patient had a successful VBAC previously? (1 = Yes). |
recurring_indication_cesarean |
Numeric (0 or 1). Was the indication for the prior cesarean section a recurring cause (e.g., arrest of dilation or descent)? (1 = Yes). |
treated_chronic_hypertension |
Numeric (0 or 1). Is the patient being treated for chronic hypertension? (1 = Yes). |
Details
The probability (P) is calculated using the logistic regression equation from the 2021 validation study:
P = \frac{1}{1 + e^{-x}}
Where x = 3.302 - 0.043(Age) - 0.052(BMI) + 0.832(AnyVaginal) + 0.489(PriorVBAC) - 0.622(RecurringIndication) - 0.513(Hypertension).
Value
A list containing:
Predicted_VBAC_Success |
The estimated percentage chance of a successful vaginal delivery. |
References
Grobman WA, et al. Prediction of Vaginal Birth After Cesarean Delivery in Term Gestations: A Calculator Without Race and Ethnicity. Am J Obstet Gynecol. 2021;225(6):664.e1-664.e7. doi:10.1016/j.ajog.2021.05.021
Examples
# Example 1: High Probability
# 30yo, BMI ~24, Prior VBAC, Non-recurring indication
vbac_success_predictor(30, 65, 145, 1, 1, 0, 0)
# Example 2: Lower Probability
# 35yo, BMI ~35, No prior vaginal, Recurring indication (arrest), Hypertension
vbac_success_predictor(35, 64, 205, 0, 0, 1, 1)
Villalta Score for Post-Thrombotic Syndrome (PTS)
Description
Calculates the Villalta Score to diagnose and grade the severity of Post-Thrombotic Syndrome in patients with a history of Deep Vein Thrombosis (DVT). The score assesses 5 subjective symptoms and 6 objective clinical signs, each rated on a scale of 0 to 3. The presence of a venous ulcer automatically classifies the condition as severe.
Usage
villalta_pts_score(pain, cramps, heaviness, paresthesia, pruritus,
pretibial_edema, skin_induration, hyperpigmentation,
redness, venous_ectasia, pain_on_calf_compression,
venous_ulcer_present)
Arguments
pain |
Numeric (0-3). Subjective rating of pain. (0=None, 1=Mild, 2=Moderate, 3=Severe). |
cramps |
Numeric (0-3). Subjective rating of cramps. |
heaviness |
Numeric (0-3). Subjective rating of heaviness. |
paresthesia |
Numeric (0-3). Subjective rating of paresthesia (pins and needles). |
pruritus |
Numeric (0-3). Subjective rating of pruritus (itching). |
pretibial_edema |
Numeric (0-3). Clinical sign of pretibial edema. |
skin_induration |
Numeric (0-3). Clinical sign of skin induration. |
hyperpigmentation |
Numeric (0-3). Clinical sign of hyperpigmentation. |
redness |
Numeric (0-3). Clinical sign of redness. |
venous_ectasia |
Numeric (0-3). Clinical sign of venous ectasia. |
pain_on_calf_compression |
Numeric (0-3). Clinical sign of pain on calf compression. |
venous_ulcer_present |
Numeric (0 or 1). Is a venous ulcer present? (1 = Yes). Note: Presence of an ulcer defines Severe PTS regardless of the numeric score. |
Value
A list containing:
Villalta_Score |
The calculated total score (Sum of the 11 items). |
Classification |
Severity classification (Absent, Mild, Moderate, Severe). |
References
Villalta S, Bagatella P, Piccioli A, et al. Assessment of validity and reproducibility of a clinical scale for the postthrombotic syndrome. Haemostasis. 1994;24(1):158a. Kahn SR. Measurement of the postthrombotic syndrome. Wounds. 2009;21(11):304-309.
Examples
# Example 1: Mild PTS
# Pain 1, Edema 1, others 0
villalta_pts_score(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0)
# Example 2: Severe PTS due to Ulcer
# Score 10, Ulcer Present
villalta_pts_score(2, 2, 2, 1, 0, 1, 1, 1, 0, 0, 0, 1)
VIRSTA Score for Infective Endocarditis
Description
Calculates the VIRSTA score to predict the risk of Infective Endocarditis (IE) in patients with Staphylococcus aureus bacteremia. The score helps identify patients at low risk for whom Transesophageal Echocardiography (TEE) might be safely avoided.
Usage
virsta_score(cerebral_emboli, meningitis, permanent_intracardiac_device,
history_infective_endocarditis, vertebral_osteomyelitis,
preexisting_native_valve_disease, intravenous_drug_use,
severe_sepsis_shock, crp_mg_l, community_acquired)
Arguments
cerebral_emboli |
Numeric (0 or 1). Presence of cerebral emboli (clinical or imaging). (1 = Yes, +5 points). |
meningitis |
Numeric (0 or 1). Presence of meningitis. (1 = Yes, +4 points). |
permanent_intracardiac_device |
Numeric (0 or 1). Presence of a permanent intracardiac device (e.g., prosthetic valve, pacemaker, ICD). (1 = Yes, +4 points). |
history_infective_endocarditis |
Numeric (0 or 1). Previous history of infective endocarditis. (1 = Yes, +3 points). |
vertebral_osteomyelitis |
Numeric (0 or 1). Presence of vertebral osteomyelitis. (1 = Yes, +3 points). |
preexisting_native_valve_disease |
Numeric (0 or 1). Pre-existing native valve disease. (1 = Yes, +3 points). |
intravenous_drug_use |
Numeric (0 or 1). Intravenous drug use. (1 = Yes, +2 points). |
severe_sepsis_shock |
Numeric (0 or 1). Presence of severe sepsis or septic shock. (1 = Yes, +1 point). |
crp_mg_l |
Numeric. C-Reactive Protein level in mg/L. (>= 190 mg/L adds +2 points). |
community_acquired |
Numeric (0 or 1). Is the bacteremia community-acquired? (1 = Yes, +1 point). |
Value
A list containing:
VIRSTA_Score |
The calculated total score. |
Risk_Category |
Risk classification (Low vs. High). |
Recommendation |
Clinical guidance regarding the need for TEE. |
References
Delahaye F, et al. Prediction of Infective Endocarditis in Patients with Staphylococcus aureus Bacteremia: The VIRSTA Score. J Am Coll Cardiol. 2016;67(20):2305-2314.
Examples
# Example 1: High Risk
# Pacemaker (+4), Fever/Sepsis (+1), Community Acquired (+1) -> Score 6
virsta_score(0, 0, 1, 0, 0, 0, 0, 1, 50, 1)
# Example 2: Low Risk
# Community Acquired (+1), CRP 100 (0), No other factors -> Score 1
virsta_score(0, 0, 0, 0, 0, 0, 0, 0, 100, 1)
Visual Acuity Testing Converter (Snellen)
Description
Converts standard Snellen visual acuity (measured at 20 feet) into other common clinical notations, including Metric (6 meters), Decimal, and LogMAR. This utility assists in standardizing visual acuity records across different medical systems and research protocols.
Usage
visual_acuity_converter(snellen_denominator)
Arguments
snellen_denominator |
Numeric. The denominator of the visual acuity fraction when the numerator is 20 (e.g., entered as 20 for 20/20 vision, 40 for 20/40 vision). Must be a positive number. |
Details
The conversions are based on the following relationships:
Decimal = 20 / Snellen Denominator
Metric Denominator = Snellen Denominator * 0.3
LogMAR = -log10(Decimal Acuity)
Value
A list containing the converted values:
Snellen_Imperial |
The standard US notation (e.g., "20/20"). |
Snellen_Metric |
The metric notation used in many other countries (e.g., "6/6"). |
Decimal |
The decimal equivalent (e.g., 1.0 for 20/20, 0.5 for 20/40). |
LogMAR |
The Logarithm of the Minimum Angle of Resolution. |
References
Holladay JT. Visual acuity measurements. J Cataract Refract Surg. 2004;30(2):287-290. doi:10.1016/j.jcrs.2004.01.014
Examples
# Example 1: 20/40 vision
visual_acuity_converter(40)
# Example 2: 20/200 vision (Legal Blindness boundary in US)
visual_acuity_converter(200)
VTE-BLEED Score
Description
Calculates the VTE-BLEED score to predict the risk of major bleeding during chronic anticoagulation therapy (stable anticoagulation after the first month) in patients with venous thromboembolism (VTE).
Usage
vte_bleed_score(active_cancer, sex, uncontrolled_hypertension, anemia,
history_of_bleeding, age, renal_dysfunction)
Arguments
active_cancer |
Numeric (0 or 1). Presence of active cancer (excluding basal cell or squamous cell carcinoma of the skin). (1 = Yes, +2 points). |
sex |
String. Patient sex. ("male" or "female"). Note: Male sex combined with uncontrolled hypertension adds +1 point. |
uncontrolled_hypertension |
Numeric (0 or 1). Presence of uncontrolled arterial hypertension (SBP > 140 mmHg). (1 = Yes). |
anemia |
Numeric (0 or 1). Presence of anemia (Hemoglobin < 13 g/dL for men, < 12 g/dL for women). (1 = Yes, +1.5 points). |
history_of_bleeding |
Numeric (0 or 1). History of prior bleeding (major or non-major clinically relevant). (1 = Yes, +1.5 points). |
age |
Numeric. Patient age in years. (>= 60 years adds +1.5 points). |
renal_dysfunction |
Numeric (0 or 1). Renal dysfunction (Creatinine clearance < 60 mL/min). (1 = Yes, +1.5 points). |
Value
A list containing:
VTE_BLEED_Score |
The calculated total score (Range 0-9). |
Risk_Category |
Classification (Low Risk < 2, High Risk >= 2). |
Observed_Bleeding_Rate |
Estimated incidence of major bleeding based on the derivation cohort. |
References
Klok FA, Barco S, Konstantinides SV, et al. External validation of the VTE-BLEED score for predicting major bleeding in stable anticoagulated patients with venous thromboembolism. Thromb Haemost. 2017;117(6):1164-1170. doi:10.1160/TH16-12-0929
Examples
# Example 1: Low Risk
# Female, 50yo, No comorbidities
vte_bleed_score(0, "female", 0, 0, 0, 50, 0)
# Example 2: High Risk
# Male, Uncontrolled HTN (+1), Age 65 (+1.5)
# Score = 2.5
vte_bleed_score(0, "male", 1, 0, 0, 65, 0)
Vesicoureteral Reflux Index (VURx)
Description
Calculates the VURx Index to predict the likelihood of spontaneous resolution of primary vesicoureteral reflux (VUR) in children. The score is based on the grade of reflux (using the International Reflux Study classification), the timing of reflux during voiding cystourethrogram (VCUG), and the patient's sex.
Usage
vurx_index(vur_grade, reflux_timing, sex)
Arguments
vur_grade |
Numeric (1-5). The grade of VUR (1-5). Grades 1-3: 0 points. Grade 4: 3 points. Grade 5: 4 points. |
reflux_timing |
String. The phase of the bladder cycle when reflux occurs. "voiding": Reflux occurs only during voiding (0 points). "filling": Reflux occurs during filling (1 point). |
sex |
String. Patient's sex. "female": 0 points. "male": 1 point. |
Value
A list containing:
VURx_Score |
The calculated index score (Range 0-6). |
Interpretation |
Prediction regarding spontaneous resolution success. |
References
Garcia-Roig M, Ridley DE, McCracken C, et al. Vesicoureteral Reflux Index: a predictive tool for spontaneous resolution of primary vesicoureteral reflux. J Urol. 2011;186(6):2391-2397. doi:10.1016/j.juro.2011.07.109
Examples
# Example 1: High likelihood of resolution
# Grade 2 (0), Voiding (0), Female (0)
# Score = 0
vurx_index(2, "voiding", "female")
# Example 2: Low likelihood of resolution
# Grade 4 (3), Filling (1), Female (0)
# Score = 4
vurx_index(4, "filling", "female")
Woman Abuse Screening Tool (WAST)
Description
Calculates the results of the Woman Abuse Screening Tool (WAST), used to identify intimate partner violence (IPV). The tool begins with two general questions (WAST-Short). If positive, further specific questions regarding physical and sexual abuse are asked.
Usage
wast_screening_tool(tension_level, argument_difficulty, partner_abuse_history,
partner_frightening, hit_kicked_punched, physical_abuse_outside,
sexual_abuse_outside, sexual_abuse_current_partner)
Arguments
tension_level |
Numeric (0-2). "In general, how would you describe your relationship?" 0: No tension 1: Some tension 2: A lot of tension |
argument_difficulty |
Numeric (0-2). "Do you and your partner work out arguments with..." 0: No difficulty 1: Some difficulty 2: Great difficulty |
partner_abuse_history |
Numeric (0 or 1). Do arguments ever result in you feeling down or bad about yourself? (Or similar emotional abuse query depending on version). (1 = Yes). |
partner_frightening |
Numeric (0 or 1). Do arguments ever result in hitting, kicking, or pushing? (1 = Yes). |
hit_kicked_punched |
Numeric (0 or 1). Do you ever feel frightened by what your partner says or does? (1 = Yes). |
physical_abuse_outside |
Numeric (0 or 1). Has your partner ever abused you physically? (1 = Yes). |
sexual_abuse_outside |
Numeric (0 or 1). Has your partner ever abused you sexually? (1 = Yes). |
sexual_abuse_current_partner |
Numeric (0 or 1). (Additional items may vary by implementation, typically standard 8 questions). (1 = Yes). |
Value
A list containing:
WAST_Short_Result |
Interpretation of the first two screening questions. |
WAST_Total_Items_Positive |
Count of positive responses across the full tool. |
Recommendation |
Suggested next steps. |
References
Brown JB, Lent B, Brett PJ, Sas G, Pederson LL. Development of the Woman Abuse Screening Tool for use in family practice. Fam Med. 1996;28(6):422-428.
Examples
# Example 1: Positive Short Screen
# Tension (2), Difficulty (2)
wast_screening_tool(2, 2, 0, 0, 0, 0, 0, 0)
# Example 2: Negative Short Screen
# No tension (0), No difficulty (0)
wast_screening_tool(0, 0, 0, 0, 0, 0, 0, 0)
Withdrawal Assessment Tool - 1 (WAT-1) for Pediatric Withdrawal
Description
Calculates the WAT-1 score to assess withdrawal symptoms in pediatric patients (typically in the PICU) who are being weaned from opioids or benzodiazepines. The scale includes an assessment of records (past 12 hours), a 2-minute pre-stimulus observation, and a stimulus-recovery assessment.
Usage
wat1_pediatric_score(loose_stools, vomiting_retching, temperature_gt_37_8,
tremor, sweating, uncoordinated_movements, yawning_sneezing,
startle_to_touch, muscle_tone, time_to_calm, agitation_state)
Arguments
loose_stools |
Numeric (0 or 1). Any loose/watery stools in the last 12 hours? (1 = Yes). |
vomiting_retching |
Numeric (0 or 1). Any vomiting or retching in the last 12 hours? (1 = Yes). |
temperature_gt_37_8 |
Numeric (0 or 1). Temperature > 37.8 C in the last 12 hours? (1 = Yes). |
tremor |
Numeric (0 or 1). Moderate to severe tremor observed during the 2-minute pre-stimulus observation? (1 = Yes). |
sweating |
Numeric (0 or 1). Any sweating observed during the 2-minute pre-stimulus observation? (1 = Yes). |
uncoordinated_movements |
Numeric (0 or 1). Uncoordinated or repetitive movements observed during the 2-minute pre-stimulus observation? (1 = Yes). |
yawning_sneezing |
Numeric (0 or 1). Yawning or sneezing (>1 time) observed during the 2-minute pre-stimulus observation? (1 = Yes). |
startle_to_touch |
Numeric (0 or 1). Moderate to severe startle response to tactile stimulus? (1 = Yes). |
muscle_tone |
Numeric (0 or 1). Increased muscle tone during stimulus? (1 = Yes). |
time_to_calm |
Numeric (0 or 1). Time to calm down after stimulus > 2-5 minutes? (1 = Yes). |
agitation_state |
Numeric (0 or 1). Patient state during the 2-minute observation. (0 = Calm/Asleep/Awake and distressed <2 mins, 1 = Awake and distressed >= 2 mins). Note: Scoring guides may vary slightly on "State" definition but generally, sustained distress adds 1 point. |
Value
A list containing:
WAT1_Score |
The calculated total score (Range 0-11 or 0-12 depending on agitation weight implementation, typically 0-11). |
Interpretation |
Clinical interpretation (Score >= 3 indicates significant withdrawal). |
References
Franck LS, Harris SK, Soetenga DJ, Amling JK, Curley MA. The Withdrawal Assessment Tool-1 (WAT-1): an assessment instrument for monitoring opioid and benzodiazepine withdrawal in pediatric patients. Pediatr Crit Care Med. 2008;9(6):573-580. doi:10.1097/PCC.0b013e31818c84bd
Examples
# Example 1: Significant Withdrawal
# Fever, Tremor, Sweating, Agitated
wat1_pediatric_score(0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1)
# Example 2: No Withdrawal
# No symptoms
wat1_pediatric_score(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Webster Rating Scale for Parkinson's Disease
Description
Calculates the Webster Rating Scale score to assess the severity of Parkinson's disease symptoms and the degree of disability. The scale consists of 10 clinical items, each rated from 0 (Normal) to 3 (Severe impairment), yielding a total score from 0 to 30.
Usage
webster_parkinsons_scale(bradykinesia, rigidity, posture, upper_extremity_swing,
gait, tremor, facies, seborrhea, speech, self_care)
Arguments
bradykinesia |
Numeric (0-3). Slowness of movement (hands, supination-pronation rate). 0: None. 1: Slowing of supination-pronation rate. 2: Moderate slowing, early fatigue. 3: Severe slowing. |
rigidity |
Numeric (0-3). Muscle stiffness. 0: None. 1: Slight rigidity in neck/shoulders. 2: Moderate rigidity in neck/shoulders/arms. 3: Severe rigidity. |
posture |
Numeric (0-3). Standing posture. 0: Normal. 1: Beginning forward flexion of head/neck. 2: Moderate flexion (Simian posture). 3: Severe flexion. |
upper_extremity_swing |
Numeric (0-3). Arm swing during walking. 0: Both arms swing well. 1: One arm definitely diminished. 2: One arm fails to swing. 3: Both arms fail to swing. |
gait |
Numeric (0-3). Walking ability. 0: Normal (stride 18-30 inches). 1: Shortened stride (12-18 inches), turning difficulty. 2: Stride 6-12 inches, shuffling, festination. 3: Onset of gait difficulty, freezing, propulsion. |
tremor |
Numeric (0-3). Involuntary shaking. 0: No tremor. 1: < 1 inch amplitude (hands). 2: Maximum amplitude 4 inches, severe excursion. 3: Continuous, > 4 inches, writing/feeding impossible. |
facies |
Numeric (0-3). Facial expression. 0: Normal. 1: Slight masking (poker face). 2: Moderate masking (lips parted). 3: Frozen face, mouth open 1/4 inch or more, drooling. |
seborrhea |
Numeric (0-3). Oiliness of skin. 0: None. 1: Increased oiliness. 2: Obvious oiliness. 3: Marked seborrhea. |
speech |
Numeric (0-3). Speech quality. 0: Clear. 1: Beginning montony/loss of volume. 2: Moderate hoarseness/monotony/dysarthria. 3: Marked hesitation/stuttering/incomprehensible. |
self_care |
Numeric (0-3). Independence in daily living. 0: No impairment. 1: Minor impairment (long time to dress). 2: Moderate impairment (requires help). 3: Severe impairment (cannot dress/feed self). |
Value
A list containing:
Webster_Score |
The calculated total score (Range 0-30). |
Severity_Classification |
Interpretation (Early Illness <= 10, Moderate Disability 11-20, Severe/Advanced > 20). |
References
Webster DD. Critical analysis of the disability in Parkinson's disease. Mod Treat. 1968;5(2):257-282.
Examples
# Example 1: Moderate Disability
# Scores of 1 or 2 across domains
webster_parkinsons_scale(1, 2, 1, 2, 1, 2, 1, 0, 1, 1)
# Example 2: Severe Disease
# High scores in motor and self-care
webster_parkinsons_scale(3, 3, 3, 3, 3, 2, 3, 1, 2, 3)
Wells' Criteria for DVT
Description
Calculates the Wells' Criteria risk stratification score for Deep Vein Thrombosis (DVT). The score classifies patients into 'Likely' or 'Unlikely' probability groups to guide diagnostic testing (e.g., D-dimer vs. Ultrasound).
Usage
wells_dvt_score(active_cancer, paralysis_paresis, bedridden_recently_surgery,
localized_tenderness, entire_leg_swollen, calf_swelling_gt_3cm,
pitting_edema, collateral_superficial_veins, history_dvt,
alternative_diagnosis_likely)
Arguments
active_cancer |
Numeric (0 or 1). Active cancer (treatment ongoing, within 6 months, or palliative). (1 = Yes, +1 point). |
paralysis_paresis |
Numeric (0 or 1). Paralysis, paresis, or recent plaster immobilization of the lower extremities. (1 = Yes, +1 point). |
bedridden_recently_surgery |
Numeric (0 or 1). Recently bedridden > 3 days or major surgery within 4 weeks requiring general or regional anesthesia. (1 = Yes, +1 point). |
localized_tenderness |
Numeric (0 or 1). Localized tenderness along the distribution of the deep venous system. (1 = Yes, +1 point). |
entire_leg_swollen |
Numeric (0 or 1). Entire leg swollen. (1 = Yes, +1 point). |
calf_swelling_gt_3cm |
Numeric (0 or 1). Calf swelling > 3 cm compared to the asymptomatic leg (measured 10 cm below tibial tuberosity). (1 = Yes, +1 point). |
pitting_edema |
Numeric (0 or 1). Pitting edema confined to the symptomatic leg. (1 = Yes, +1 point). |
collateral_superficial_veins |
Numeric (0 or 1). Collateral superficial veins (non-varicose). (1 = Yes, +1 point). |
history_dvt |
Numeric (0 or 1). Previously documented DVT. (1 = Yes, +1 point). |
alternative_diagnosis_likely |
Numeric (0 or 1). Alternative diagnosis at least as likely as DVT. (1 = Yes, -2 points). |
Value
A list containing:
Wells_Score |
The calculated score (Range -2 to 9). |
Risk_Category |
Classification (Unlikely <2, Likely >=2). |
Probability |
Estimated prevalence of DVT in the risk group. |
References
Wells PS, Anderson DR, Bormanis J, et al. Value of assessment of pretest probability of deep-vein thrombosis in clinical management. Lancet. 1997;350(9094):1795-1798. doi:10.1016/S0140-6736(97)08140-3
Examples
# Example 1: DVT Likely
# Cancer (+1), Swelling >3cm (+1), Tenderness (+1)
# Score = 3
wells_dvt_score(1, 0, 0, 1, 0, 1, 0, 0, 0, 0)
# Example 2: DVT Unlikely
# Recent surgery (+1), but alternative diagnosis likely (-2)
# Score = -1
wells_dvt_score(0, 0, 1, 0, 0, 0, 0, 0, 0, 1)
Wells' Criteria for Pulmonary Embolism
Description
Calculates the Wells' Criteria risk stratification score for Pulmonary Embolism (PE). The score stratifies patients into risk groups to guide diagnostic testing (e.g., D-dimer testing vs. CT Pulmonary Angiography).
Usage
wells_pe_score(clinical_signs_dvt, pe_number_one_diagnosis, heart_rate,
immobilization_surgery, previous_pe_dvt, hemoptysis, malignancy)
Arguments
clinical_signs_dvt |
Numeric (0 or 1). Clinical signs and symptoms of DVT (leg swelling and pain with palpation of deep veins). (1 = Yes, +3.0 points). |
pe_number_one_diagnosis |
Numeric (0 or 1). Is PE the #1 diagnosis or equally likely? (1 = Yes, +3.0 points). |
heart_rate |
Numeric. Heart rate in beats per minute. (>100 bpm adds +1.5 points). |
immobilization_surgery |
Numeric (0 or 1). Immobilization at least 3 days OR surgery in the previous 4 weeks. (1 = Yes, +1.5 points). |
previous_pe_dvt |
Numeric (0 or 1). Previous, objectively diagnosed PE or DVT. (1 = Yes, +1.5 points). |
hemoptysis |
Numeric (0 or 1). Presence of hemoptysis. (1 = Yes, +1.0 point). |
malignancy |
Numeric (0 or 1). Malignancy with treatment within 6 months or palliative. (1 = Yes, +1.0 point). |
Value
A list containing:
Wells_Score |
The calculated total score. |
Risk_Tier_3 |
Risk classification based on the 3-tier model (Low < 2, Moderate 2-6, High > 6). |
Risk_Tier_2 |
Risk classification based on the 2-tier model (Unlikely <= 4, Likely > 4). |
References
Wells PS, Anderson DR, Rodger M, et al. Derivation of a simple clinical model to categorize patients probability of pulmonary embolism: increasing the models utility with the SimpliRED D-dimer. Thromb Haemost. 2000;83(3):416-420.
Examples
# Example 1: High Risk
# Clinical signs (1), PE #1 Dx (1)
# Score = 6.0
wells_pe_score(1, 1, 80, 0, 0, 0, 0)
# Example 2: Moderate Risk
# HR 110 (1.5), Surgery (1.5)
# Score = 3.0
wells_pe_score(0, 0, 110, 1, 0, 0, 0)
Westley Croup Score
Description
Calculates the Westley Croup Score to assess the severity of croup (laryngotracheobronchitis) in children. The score evaluates five clinical signs: chest wall retractions, stridor, cyanosis, level of consciousness, and air entry.
Usage
westley_croup_score(chest_wall_retractions, stridor, cyanosis,
level_of_consciousness, air_entry)
Arguments
chest_wall_retractions |
Numeric (0-3). 0: None. 1: Mild. 2: Moderate. 3: Severe. |
stridor |
Numeric (0-2). 0: None. 1: With agitation. 2: At rest. |
cyanosis |
Numeric (0-5). 0: None. 4: With agitation. 5: At rest. |
level_of_consciousness |
Numeric (0-5). 0: Normal. 5: Disoriented. |
air_entry |
Numeric (0-2). 0: Normal. 1: Decreased. 2: Markedly decreased. |
Value
A list containing:
Westley_Score |
The calculated total score (Range 0-17). |
Severity_Classification |
Clinical severity category (Mild <=2, Moderate 3-5, Severe 6-11, Impending Failure >=12). |
References
Westley CR, Cotton EK, Brooks JG. Nebulized racemic epinephrine by IPPB for the treatment of croup: a double-blind study. Am J Dis Child. 1978;132(5):484-487. doi:10.1001/archpedi.1978.02120300040007
Examples
# Example 1: Moderate Croup
# Mild retractions (1), Stridor at rest (2),
#No cyanosis (0), Normal LOC (0), Decreased air entry (1)
# Score = 4
westley_croup_score(1, 2, 0, 0, 1)
# Example 2: Severe Croup
# Severe retractions (3), Stridor at rest (2),
#Agitated cyanosis (4), Normal LOC (0), Decreased air (1)
# Score = 10
westley_croup_score(3, 2, 4, 0, 1)
Wexner Score for Obstructed Defecation Syndrome (ODS)
Description
Calculates the Wexner Constipation Score (also known as the Agachan-Wexner Score) for evaluating the severity of constipation and Obstructed Defecation Syndrome. The score ranges from 0 to 30 (though often modified versions like the ODS-specific subset sum to 20 or similar, this function assumes standard item summation as per the original validation for constipation severity).
Usage
wexner_ods_score(bowel_movement_frequency, straining,
sensation_incomplete_evacuation, use_of_enemas_laxatives,
abdominal_pain, time_per_attempt_minutes,
assistance_needed_per_attempt, unsuccessful_attempts_per_24h)
Arguments
bowel_movement_frequency |
Numeric (0-2 or 0-4 depending on scale variant). Frequency of bowel movements. |
straining |
Numeric (0-4). Frequency of straining (Never to Always). |
sensation_incomplete_evacuation |
Numeric (0-4). Frequency of incomplete evacuation sensation. |
use_of_enemas_laxatives |
Numeric (0-2). Use of enemas or laxatives. |
abdominal_pain |
Numeric (0-4). Frequency of abdominal pain. |
time_per_attempt_minutes |
Numeric (0-4). Duration of time in lavatory per attempt. |
assistance_needed_per_attempt |
Numeric (0-2). Type of assistance needed (None, Digitation, Enema). |
unsuccessful_attempts_per_24h |
Numeric (0-4). Number of unsuccessful attempts at evacuation per 24 hours. |
Value
A list containing:
Wexner_ODS_Score |
The calculated total score. |
Interpretation |
General interpretation guide. |
References
Agachan F, Chen T, Pfeifer J, Reissman P, Wexner SD. A constipation scoring system to simplify evaluation and management of constipated patients. Dis Colon Rectum. 1996;39(6):681-685. doi:10.1007/bf02056950
Examples
# Example 1: Severe ODS
# Freq(1), Strain(4), Incomplete(4), Laxatives(2), Pain(3), Time(4), Assist(2), Unsuccessful(4)
# Score = 24
wexner_ods_score(1, 4, 4, 2, 3, 4, 2, 4)
# Example 2: Mild
# All 0s
wexner_ods_score(0, 0, 0, 0, 0, 0, 0, 0)
WHO Diagnostic Criteria for Polycythemia Vera (2016)
Description
Evaluates the 2016 World Health Organization (WHO) diagnostic criteria for Polycythemia Vera (PV). Diagnosis requires either all three major criteria, or the first two major criteria plus the minor criterion. NOTE: Bone marrow biopsy (Major Criterion 2) may not be required in cases with sustained absolute erythrocytosis (Hb >18.5 g/dL in men or >16.5 g/dL in women) if Major Criterion 3 and the Minor Criterion are present.
Usage
who_pv_criteria(sex, hemoglobin, hematocrit, red_cell_mass_elevated,
bone_marrow_biopsy, jak2_mutation, serum_epo_low)
Arguments
sex |
String. Patient sex ("Male" or "Female"). Used to determine hemoglobin/hematocrit thresholds. |
hemoglobin |
Numeric. Hemoglobin level in g/dL. |
hematocrit |
Numeric. Hematocrit percentage (0-100). |
red_cell_mass_elevated |
Numeric (0 or 1). Is the red cell mass > 25% above the mean normal predicted value? (1 = Yes). Alternative for Major Criterion 1. |
bone_marrow_biopsy |
Numeric (0 or 1). Bone marrow biopsy showing hypercellularity for age with trilineage growth (panmyelosis). (1 = Yes). (Major Criterion 2). |
jak2_mutation |
Numeric (0 or 1). Presence of JAK2 V617F or JAK2 Exon 12 mutation. (1 = Yes). (Major Criterion 3). |
serum_epo_low |
Numeric (0 or 1). Subnormal serum erythropoietin level. (1 = Yes). (Minor Criterion). |
Value
A list containing:
Diagnosis |
"Criteria Met for Polycythemia Vera" or "Criteria Not Met". |
Criteria_Status |
A list of boolean values indicating which specific criteria were satisfied. |
References
Arber DA, Orazi A, Hasserjian R, et al. The 2016 revision to the World Health Organization classification of myeloid neoplasms and acute leukemia. Blood. 2016;127(20):2391-2405. doi:10.1182/blood-2016-03-643544
Examples
# Example 1: Diagnosis Met (3 Major Criteria)
# Male, Hb 17.0, Hct 50, Biopsy+, JAK2+
who_pv_criteria("male", 17.0, 50, 0, 1, 1, 0)
# Example 2: Diagnosis Met (2 Major + 1 Minor)
# Female, Hb 16.2, Hct 49, Biopsy+, JAK2-, Low EPO
who_pv_criteria("female", 16.2, 49, 0, 1, 0, 1)
WHO Diagnostic Criteria for Systemic Mastocytosis (2016)
Description
Evaluates the 2016 World Health Organization (WHO) diagnostic criteria for Systemic Mastocytosis (SM). Diagnosis requires either one major criterion and at least one minor criterion, OR at least three minor criteria.
Usage
who_sm_criteria(bone_marrow_aggregates, aberrant_cd25_expression,
kit_d816v_mutation, serum_tryptase_elevated,
spindle_cells_abnormal)
Arguments
bone_marrow_aggregates |
Numeric (0 or 1). Major Criterion: Multifocal dense infiltrates of mast cells (>=15 mast cells in aggregates) detected in sections of bone marrow and/or other extracutaneous organs. (1 = Yes). |
aberrant_cd25_expression |
Numeric (0 or 1). Minor Criterion: Mast cells in bone marrow, blood, or other extracutaneous organs express CD25 (and/or CD2) in addition to normal mast cell markers. (1 = Yes). |
kit_d816v_mutation |
Numeric (0 or 1). Minor Criterion: Detection of KIT mutation at codon 816 in bone marrow, blood, or other extracutaneous organs. (1 = Yes). |
serum_tryptase_elevated |
Numeric (0 or 1). Minor Criterion: Serum total tryptase persistently exceeds 20 ng/mL (unless there is an associated clonal myeloid disorder). (1 = Yes). |
spindle_cells_abnormal |
Numeric (0 or 1). Minor Criterion: >25% of mast cells in bone marrow or other extracutaneous organ sections are spindle-shaped or have atypical morphology, or >25% of mast cells in bone marrow aspirate smears are immature or atypical. (1 = Yes). |
Value
A list containing:
Diagnosis |
"Criteria Met for Systemic Mastocytosis" or "Criteria Not Met". |
Criteria_Status |
A summary of the major criterion and the count of minor criteria met. |
References
Arber DA, Orazi A, Hasserjian R, et al. The 2016 revision to the World Health Organization classification of myeloid neoplasms and acute leukemia. Blood. 2016;127(20):2391-2405. doi:10.1182/blood-2016-03-643544
Examples
# Example 1: Diagnosis Met (Major + 1 Minor)
# Aggregates present, KIT mutation present
who_sm_criteria(1, 0, 1, 0, 0)
# Example 2: Diagnosis Met (3 Minor)
# No aggregates, but CD25+, KIT+, Tryptase >20
who_sm_criteria(0, 1, 1, 1, 0)
Wound, Ischemia, and foot Infection (WIfI) Classification System
Description
Calculates the WIfI classification stage to predict the 1-year risk of major amputation and the potential benefit of revascularization in patients with threatened lower limbs (chronic limb-threatening ischemia). The system integrates three key factors: Wound extent, Ischemia severity, and foot Infection severity.
Usage
wifi_classification(wound_grade, ischemia_grade, infection_grade)
Arguments
wound_grade |
Numeric (0-3). 0: No ulcer/gangrene. 1: Small ulcer, no gangrene. 2: Deep ulcer or gangrene limited to digits. 3: Extensive ulcer or gangrene involving forefoot/midfoot. |
ischemia_grade |
Numeric (0-3). Based on ABI, Ankle Pressure (AP), or Toe Pressure (TP). 0: ABI >= 0.80, TP >= 60. 1: ABI 0.6-0.79, TP 40-59. 2: ABI 0.4-0.59, TP 30-39. 3: ABI <= 0.39, TP < 30. |
infection_grade |
Numeric (0-3). Based on IDSA/IWGDF criteria. 0: No infection. 1: Mild (local < 2cm cellulitis). 2: Moderate (> 2cm cellulitis or deep structures). 3: Severe (SIRS/Sepsis). |
Value
A list containing:
WIfI_Stage |
The calculated clinical stage (1-4). |
Amputation_Risk_1_Year |
Estimated risk of major amputation at 1 year (Very Low, Low, Moderate, High). |
Revascularization_Benefit |
Estimated benefit of revascularization. |
References
Mills JL Sr, Conte MS, Armstrong DG, et al. The Society for Vascular Surgery Lower Extremity Threatened Limb Classification System: risk stratification based on wound, ischemia, and foot infection (WIfI). J Vasc Surg. 2014;59(1):220-34.e1-2. doi:10.1016/j.jvs.2013.08.003
Examples
# Example 1: High Risk
# Extensive gangrene (3), Severe Ischemia (3), Moderate Infection (2)
wifi_classification(3, 3, 2)
# Example 2: Low Risk
# Small ulcer (1), Mild Ischemia (1), No Infection (0)
wifi_classification(1, 1, 0)
Winter's Formula for Metabolic Acidosis Compensation
Description
Calculates the expected partial pressure of carbon dioxide (PaCO2) in the setting of metabolic acidosis to determine if the respiratory compensation is appropriate. If the measured PaCO2 falls outside the calculated range, a concomitant respiratory disorder exists.
Usage
winters_formula(bicarbonate, measured_paco2 = NULL)
Arguments
bicarbonate |
Numeric. The serum bicarbonate (HCO3) level in mEq/L or mmol/L. |
measured_paco2 |
Numeric (Optional). The measured arterial PaCO2 in mmHg. If provided, the function evaluates whether a mixed acid-base disorder is present. |
Details
The formula used is:
Expected PaCO_2 = (1.5 \times HCO_3) + 8 \pm 2
Interpretation of results when PaCO2 is provided:
-
Within Range: Pure metabolic acidosis with appropriate respiratory compensation.
-
< Lower Limit: Concomitant Respiratory Alkalosis.
-
> Upper Limit: Concomitant Respiratory Acidosis.
Value
A list containing:
Expected_PaCO2_Range_mmHg |
The range of expected PaCO2 values. |
Interpretation |
Analysis of the compensation status based on the measured PaCO2. |
References
Albert MS, Dell RB, Winters RW. Quantitative displacement of acid-base equilibrium in metabolic acidosis. Ann Intern Med. 1967;66(2):312-322. doi:10.7326/0003-4819-66-2-312
Examples
# Example 1: Compensated Metabolic Acidosis
# HCO3 = 14, PaCO2 = 29
# Exp = (1.5 * 14) + 8 = 29 +/- 2 = 27-31
winters_formula(14, 29)
# Example 2: Concomitant Respiratory Acidosis
# HCO3 = 14, PaCO2 = 35 (Higher than expected range 27-31)
winters_formula(14, 35)
Wisconsin Criteria for Maxillofacial CT Imaging
Description
Calculates the Wisconsin Criteria to determine the need for maxillofacial CT imaging in patients with facial trauma. The presence of any one of the five criteria suggests a higher risk of facial fracture and indicates the need for imaging.
Usage
wisconsin_maxillofacial_criteria(bony_stepoff_instability, periorbital_swelling,
gcs_score, malocclusion, tooth_absence)
Arguments
bony_stepoff_instability |
Numeric (0 or 1). Presence of bony step-off or instability of the facial bones. (1 = Yes). |
periorbital_swelling |
Numeric (0 or 1). Presence of periorbital swelling or contusion. (1 = Yes). |
gcs_score |
Numeric. Glasgow Coma Scale score (3-15). A score < 14 is considered a positive criterion. |
malocclusion |
Numeric (0 or 1). Presence of malocclusion (misalignment of teeth). (1 = Yes). |
tooth_absence |
Numeric (0 or 1). Absence of a tooth (avulsion) secondary to trauma. (1 = Yes). |
Value
A list containing:
Result |
Recommendation regarding the need for CT imaging. |
Criteria_Met |
Boolean indicating if any risk factor is present. |
References
Sitzman TJ, Hanson SE, Al-Sheikhi N, et al. Clinical criteria for obtaining maxillofacial computed tomography in trauma patients. Plast Reconstr Surg. 2011;127(3):1270-1278. doi:10.1097/PRS.0b013e318205f2e0
Examples
# Example 1: Imaging Indicated
# Patient has periorbital swelling (1) and GCS 15
wisconsin_maxillofacial_criteria(0, 1, 15, 0, 0)
# Example 2: Imaging Not Indicated
# No findings, GCS 15
wisconsin_maxillofacial_criteria(0, 0, 15, 0, 0)
Wound Closure Classification System
Description
Classifies the type of wound closure based on clinical management. This system categorizes wound healing into Primary Intention (immediate closure), Secondary Intention (healing by granulation), and Tertiary Intention (delayed primary closure).
Usage
wound_closure_classification(wound_status)
Arguments
wound_status |
String. The clinical method of wound management. Options: "primary" (Immediate approximation of edges), "secondary" (Left open to heal by granulation), "tertiary" (Delayed closure after observation). |
Value
A list containing:
Classification_Type |
The formal classification name. |
Description |
A detailed explanation of the healing process for that classification. |
Examples |
Common clinical scenarios for the selected closure type. |
References
Boardman JD, et al. Wound Closure. StatPearls [Internet]. Treasure Island (FL): StatPearls Publishing; 2023.
Examples
# Example 1: Surgical Incision
# Primary closure
wound_closure_classification("primary")
# Example 2: Infected Dog Bite
# Delayed closure
wound_closure_classification("tertiary")
WPSS Classification for Myelodysplastic Syndrome
Description
Calculates the WHO Classification-based Prognostic Scoring System (WPSS) score for Myelodysplastic Syndrome (MDS). The score predicts survival and the risk of leukemic evolution based on WHO classification, karyotype abnormalities, and transfusion requirement.
Usage
wpss_score(who_classification, karyotype, transfusion_requirement)
Arguments
who_classification |
String. WHO subtype of MDS. Options: "rcud_rars_rcmd" (Refractory cytopenia with unilineage dysplasia, Refractory anemia with ringed sideroblasts, or Refractory cytopenia with multilineage dysplasia): 0 points. "raeb_1" (Refractory anemia with excess blasts-1): 1 point. "raeb_2" (Refractory anemia with excess blasts-2): 2 points. |
karyotype |
String. Cytogenetic risk group. "good" (Normal, -Y, del(5q), del(20q)): 0 points. "intermediate" (Other abnormalities): 1 point. "poor" (Complex >=3 abnormalities, chromosome 7 anomalies): 2 points. |
transfusion_requirement |
String. Requirement for regular RBC transfusions. "no": 0 points. "regular": 1 point. |
Value
A list containing:
WPSS_Score |
The calculated total score (Range 0-5). |
Risk_Group |
Risk classification (Very Low, Low, Intermediate, High, Very High). |
Median_Survival |
Estimated median survival time. |
AML_Progression_Risk_2yr |
Estimated risk of progression to Acute Myeloid Leukemia at 2 years. |
References
Malcovati L, Germing U, Kuendgen A, et al. Time-dependent prognostic scoring system for predicting survival and leukemic evolution in myelodysplastic syndromes. J Clin Oncol. 2007;25(23):3503-3510. doi:10.1200/JCO.2006.08.5696
Examples
# Example 1: Very Low Risk
# RCUD/RARS, Good karyotype, No transfusion
wpss_score("rcud_rars_rcmd", "good", "no")
# Example 2: High Risk
# RAEB-1 (1), Poor karyotype (2), Regular transfusion (1) -> Score 4
wpss_score("raeb_1", "poor", "regular")
YEARS Algorithm for Pulmonary Embolism (PE)
Description
Implements the YEARS algorithm to rule out pulmonary embolism in hemodynamically stable patients. This algorithm uses three clinical criteria combined with D-dimer levels to adjust the D-dimer threshold for ruling out PE, potentially reducing the need for CT pulmonary angiography (CTPA).
Usage
years_pe_algorithm(clinical_signs_dvt, hemoptysis, pe_most_likely,
d_dimer_level, d_dimer_units = "ng/mL")
Arguments
clinical_signs_dvt |
Numeric (0 or 1). Clinical signs of deep vein thrombosis (e.g., swelling, edema). (1 = Yes). |
hemoptysis |
Numeric (0 or 1). Presence of hemoptysis. (1 = Yes). |
pe_most_likely |
Numeric (0 or 1). Is Pulmonary Embolism the most likely diagnosis? (1 = Yes). |
d_dimer_level |
Numeric. D-dimer level. Assumed to be in Fibrinogen Equivalent Units (FEU). |
d_dimer_units |
String. Units for D-dimer input. "ng/mL" (default) or "ug/mL" (or "mg/L"). |
Details
The algorithm logic is as follows:
If 0 YEARS criteria are present: PE is ruled out if D-dimer < 1000 ng/mL.
If >= 1 YEARS criteria are present: PE is ruled out if D-dimer < 500 ng/mL.
If the D-dimer level is above the specific threshold, CTPA is indicated.
Value
A list containing:
Result |
"PE Ruled Out" or "CTPA Indicated". |
YEARS_Items_Met |
The count of positive clinical criteria (0-3). |
D_Dimer_Threshold_Used |
The specific D-dimer cutoff used for the evaluation (500 or 1000). |
References
van der Hulle T, Cheung WY, Kooij S, et al. Simplified diagnostic management of suspected pulmonary embolism (the YEARS study): a prospective, multicentre, cohort study. Lancet. 2017;390(10091):289-297. doi:10.1016/S0140-6736(17)30885-1
Examples
# Example 1: 0 Criteria, High D-dimer (Rule Out due to high threshold)
# No signs, No hemoptysis, PE not most likely, D-dimer 800
# Threshold = 1000. 800 < 1000 -> Ruled Out.
years_pe_algorithm(0, 0, 0, 800)
# Example 2: 1 Criteria, Moderate D-dimer (CTPA Indicated)
# PE most likely (1), D-dimer 600
# Threshold = 500. 600 >= 500 -> CTPA Indicated.
years_pe_algorithm(0, 0, 1, 600)